Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 15f2b412
authored
Sep 24, 2014
by
Sveinn Fannar Kristjansson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for json dot syntax
1 parent
1fd04f79
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
test/postgres/dao.test.js
test/postgres/dao.test.js
View file @
15f2b41
...
@@ -155,13 +155,27 @@ if (dialect.match(/^postgres/)) {
...
@@ -155,13 +155,27 @@ if (dialect.match(/^postgres/)) {
this
.
User
.
create
({
username
:
'anna'
,
emergency_contact
:
{
name
:
'joe'
}
})])
this
.
User
.
create
({
username
:
'anna'
,
emergency_contact
:
{
name
:
'joe'
}
})])
.
then
(
function
()
{
.
then
(
function
()
{
return
self
.
User
.
find
({
return
self
.
User
.
find
({
where
:
sequelize
.
json
({
emergency_contact
:
{
name
:
'kate'
}
})
,
where
:
sequelize
.
json
({
emergency_contact
:
{
name
:
'kate'
}
})
attributes
:
[
'username'
,
'emergency_contact'
]
});
});
})
})
.
then
(
function
(
user
)
{
.
then
(
function
(
user
)
{
expect
(
user
.
emergency_contact
.
name
).
to
.
equal
(
'kate'
);
expect
(
user
.
emergency_contact
.
name
).
to
.
equal
(
'kate'
);
});
});
});
});
it
(
'should be ablo to query using dot syntax'
,
function
()
{
var
self
=
this
;
return
this
.
sequelize
.
Promise
.
all
([
this
.
User
.
create
({
username
:
'swen'
,
emergency_contact
:
{
name
:
'kate'
}
}),
this
.
User
.
create
({
username
:
'anna'
,
emergency_contact
:
{
name
:
'joe'
}
})])
.
then
(
function
()
{
return
self
.
User
.
find
({
where
:
sequelize
.
json
(
'emergency_contact.name'
,
'joe'
)
});
})
.
then
(
function
(
user
)
{
expect
(
user
.
emergency_contact
.
name
).
to
.
equal
(
'joe'
);
});
});
});
});
describe
(
'hstore'
,
function
()
{
describe
(
'hstore'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment