Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
jio
Commits
c0733eb3
Commit
c0733eb3
authored
Jun 23, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mappingstorage: add tests for previews commit
parent
5005cb7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
src/jio.storage/mappingstorage.js
src/jio.storage/mappingstorage.js
+3
-0
test/jio.storage/mappingstorage.tests.js
test/jio.storage/mappingstorage.tests.js
+32
-12
No files found.
src/jio.storage/mappingstorage.js
View file @
c0733eb3
...
...
@@ -347,6 +347,9 @@
.
push
(
function
(
sub_id
)
{
return
storage
.
_sub_storage
.
put
(
sub_id
,
sub_doc
);
})
.
push
(
function
()
{
return
doc
[
storage
.
_id_mapped
];
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
)
{
return
storage
.
_sub_storage
.
post
(
sub_doc
);
...
...
test/jio.storage/mappingstorage.tests.js
View file @
c0733eb3
...
...
@@ -56,7 +56,7 @@
deepEqual
(
jio
.
__storage
.
_mapping_dict
,
{
"
bar
"
:
[
"
equalSubProperty
"
,
"
foo
"
]}
{
"
bar
"
:
[
"
equalSubProperty
"
,
"
foo
"
]
,
"
otherId
"
:
[
"
keep
"
]
}
);
deepEqual
(
jio
.
__storage
.
_map_id
,
[
"
equalSubProperty
"
,
"
otherId
"
]);
equal
(
jio
.
__storage
.
_query
.
query
.
key
,
"
foo
"
);
...
...
@@ -130,13 +130,14 @@
Storage2713
.
prototype
.
get
=
function
(
id
)
{
equal
(
id
,
"
2713
"
,
"
get 2713 called
"
);
return
{
"
title
"
:
"
foo
"
};
return
{
"
title
"
:
"
foo
"
,
"
otherId
"
:
"
42
"
};
};
jio
.
get
(
"
42
"
)
.
push
(
function
(
result
)
{
deepEqual
(
result
,
{
"
title
"
:
"
foo
"
"
title
"
:
"
foo
"
,
"
otherId
"
:
"
42
"
});
}).
push
(
undefined
,
function
(
error
)
{
ok
(
false
,
error
);
...
...
@@ -169,13 +170,14 @@
Storage2713
.
prototype
.
get
=
function
(
id
)
{
equal
(
id
,
"
2713
"
,
"
get 2713 called
"
);
return
{
"
title
"
:
"
foo
"
};
return
{
"
title
"
:
"
foo
"
,
"
otherId
"
:
"
42
"
};
};
jio
.
get
(
"
42
"
)
.
push
(
function
(
result
)
{
deepEqual
(
result
,
{
"
title
"
:
"
foo
"
"
title
"
:
"
foo
"
,
"
otherId
"
:
"
42
"
});
}).
push
(
undefined
,
function
(
error
)
{
ok
(
false
,
error
);
...
...
@@ -652,7 +654,7 @@
test
(
"
with id equalSubProperty and id in doc
"
,
function
()
{
stop
();
expect
(
2
);
expect
(
3
);
var
jio
=
jIO
.
createJIO
({
type
:
"
mapping
"
,
...
...
@@ -667,9 +669,18 @@
return
"
42
"
;
};
Storage2713
.
prototype
.
put
=
function
(
id
,
doc
)
{
equal
(
id
,
"
bar
"
,
"
put 2713 called
"
);
deepEqual
(
doc
,
{
"
title
"
:
"
foo
"
,
"
otherId
"
:
"
bar
"
},
"
put 2713 called
"
);
return
"
42
"
;
};
jio
.
post
({
"
title
"
:
"
foo
"
,
"
otherId
"
:
"
bar
"
})
.
push
(
function
(
result
)
{
equal
(
result
,
"
42
"
);
equal
(
result
,
"
bar
"
);
})
.
push
(
undefined
,
function
(
error
)
{
ok
(
false
,
error
);
...
...
@@ -1205,7 +1216,8 @@
"
id
"
:
"
42
"
,
"
value
"
:
{
"
title
"
:
"
foo
"
,
"
smth
"
:
"
bar
"
"
smth
"
:
"
bar
"
,
"
otherId
"
:
"
42
"
},
"
doc
"
:
{}
},
...
...
@@ -1213,7 +1225,8 @@
"
id
"
:
"
2713
"
,
"
value
"
:
{
"
title
"
:
"
bar
"
,
"
smth
"
:
"
foo
"
"
smth
"
:
"
foo
"
,
"
otherId
"
:
"
2713
"
},
"
doc
"
:
{}
}
...
...
@@ -1266,7 +1279,9 @@
"
rows
"
:
[
{
"
id
"
:
"
42
"
,
"
value
"
:
{},
"
value
"
:
{
"
otherId
"
:
"
42
"
},
"
doc
"
:
{}
}
],
...
...
@@ -1321,7 +1336,7 @@
"
rows
"
:
[
{
"
id
"
:
"
42
"
,
"
value
"
:
{
"
title
"
:
"
foo
"
,
"
smth
"
:
"
bar
"
},
"
value
"
:
{
"
title
"
:
"
foo
"
,
"
smth
"
:
"
bar
"
,
"
otherId
"
:
"
42
"
},
"
doc
"
:
{}
}
],
...
...
@@ -1377,7 +1392,10 @@
"
rows
"
:
[
{
"
id
"
:
"
42
"
,
"
value
"
:
{
"
title
"
:
"
foo
"
},
"
value
"
:
{
"
otherId
"
:
"
42
"
,
"
title
"
:
"
foo
"
},
"
doc
"
:
{}
}
],
...
...
@@ -1463,9 +1481,11 @@
result
,
[{
"
title
"
:
"
bar
"
,
"
otherId
"
:
"
foo
"
,
"
bar
"
:
"
foo
"
},
{
"
title
"
:
"
foo
"
,
"
otherId
"
:
"
bar
"
,
"
foo
"
:
"
bar
"
}],
"
bulk test
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment