Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
jio-main
Commits
9bb5cdfc
Commit
9bb5cdfc
authored
Dec 05, 2016
by
Hardik Juneja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve performance and make build query use new functions
parent
2ca6c591
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
184 additions
and
142 deletions
+184
-142
src/jio.storage/mappingstorage.js
src/jio.storage/mappingstorage.js
+123
-131
test/jio.storage/mappingstorage.tests.js
test/jio.storage/mappingstorage.tests.js
+61
-11
No files found.
src/jio.storage/mappingstorage.js
View file @
9bb5cdfc
This diff is collapsed.
Click to expand it.
test/jio.storage/mappingstorage.tests.js
View file @
9bb5cdfc
...
...
@@ -428,7 +428,7 @@
});
});
test
(
"
get with property a
nd its value mapped using regex
"
,
function
()
{
test
(
"
get with property a
d value mapped using regex and switch
"
,
function
()
{
stop
();
expect
(
2
);
...
...
@@ -439,10 +439,16 @@
},
mapping_dict
:
{
"
title
"
:
{
"
equal
"
:
"
someTitle
"
,
"
value
"
:
{
"
otherFoo
"
:
{
"
regex
"
:
"
foo.*|bar.*
"
,
"
switch
"
:
{
"
foo
"
:
{
"
regex
"
:
"
other.*
"
,
"
default_value
"
:
"
otherFoo
"
},
"
bar
"
:
{
"
equal
"
:
"
otherBar
"
}
}
}
}
...
...
@@ -451,13 +457,13 @@
Storage2713
.
prototype
.
get
=
function
(
id
)
{
equal
(
id
,
"
42
"
,
"
get 2713 called
"
);
return
{
"
t
itle
"
:
"
otherFoo
"
,
"
smth
"
:
"
bar
"
};
return
{
"
someT
itle
"
:
"
otherFoo
"
,
"
smth
"
:
"
bar
"
};
};
jio
.
get
(
"
42
"
)
.
push
(
function
(
result
)
{
deepEqual
(
result
,
{
"
title
"
:
"
otherF
oo
"
,
"
title
"
:
"
f
oo
"
,
"
smth
"
:
"
bar
"
});
}).
push
(
undefined
,
function
(
error
)
{
...
...
@@ -832,9 +838,55 @@
"
title
"
:
{
"
equal
"
:
"
someTitle
"
,
"
value
"
:
{
"
otherF
oo
"
:
{
"
f
oo
"
:
{
"
regex
"
:
"
foo.*|bar.*
"
,
"
use
"
:
"
otherFoo
"
"
default_value
"
:
"
otherFoo
"
}
}
}
}
});
Storage2713
.
prototype
.
put
=
function
(
id
,
doc
)
{
deepEqual
(
doc
,
{
"
someTitle
"
:
"
otherFoo
"
,
"
smth
"
:
"
bar
"
},
"
post 2713 called
"
);
equal
(
id
,
"
42
"
,
"
put 2713 called
"
);
return
id
;
};
jio
.
put
(
"
42
"
,
{
"
title
"
:
"
foo
"
,
"
smth
"
:
"
bar
"
})
.
push
(
function
(
result
)
{
equal
(
result
,
"
42
"
);
})
.
push
(
undefined
,
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
test
(
"
put with property, value mapped using regex and switch
"
,
function
()
{
stop
();
expect
(
3
);
var
jio
=
jIO
.
createJIO
({
type
:
"
mapping
"
,
sub_storage
:
{
type
:
"
mappingstorage2713
"
},
mapping_dict
:
{
"
title
"
:
{
"
equal
"
:
"
someTitle
"
,
"
value
"
:
{
"
switch
"
:
{
"
foo
"
:
{
"
regex
"
:
"
other.*
"
,
"
default_value
"
:
"
otherFoo
"
},
"
bar
"
:
{
"
equal
"
:
"
otherBar
"
}
}
}
}
...
...
@@ -848,7 +900,7 @@
return
id
;
};
jio
.
put
(
"
42
"
,
{
"
title
"
:
"
foo
1
"
,
"
smth
"
:
"
bar
"
})
jio
.
put
(
"
42
"
,
{
"
title
"
:
"
foo
"
,
"
smth
"
:
"
bar
"
})
.
push
(
function
(
result
)
{
equal
(
result
,
"
42
"
);
})
...
...
@@ -1732,11 +1784,9 @@
deepEqual
(
result
,
[{
"
id
"
:
"
foo
"
,
"
title
"
:
"
bar
"
,
"
bar
"
:
"
foo
"
},
{
"
id
"
:
"
bar
"
,
"
title
"
:
"
foo
"
,
"
foo
"
:
"
bar
"
}],
...
...
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