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 97ff7a47
authored
Dec 29, 2014
by
Nick Kleinschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case for updating a JSON field using postgres with a custom field name
1 parent
7895f286
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
test/dialects/postgres/dao.test.js
test/dialects/postgres/dao.test.js
View file @
97ff7a4
...
...
@@ -72,6 +72,41 @@ if (dialect.match(/^postgres/)) {
});
});
it
(
'should insert json using a custom field name'
,
function
(
done
)
{
var
self
=
this
;
this
.
UserFields
=
this
.
sequelize
.
define
(
'UserFields'
,
{
emergency_contact
:
{
type
:
DataTypes
.
JSON
,
field
:
'something_else'
}
});
this
.
UserFields
.
sync
({
force
:
true
}).
then
(
function
()
{
self
.
UserFields
.
create
({
emergency_contact
:
{
name
:
'joe'
,
phones
:
[
1337
,
42
]
}
}).
then
(
function
(
user
)
{
expect
(
user
.
emergency_contact
.
name
).
to
.
equal
(
'joe'
);
done
();
});
});
});
it
(
'should update json using a custom field name'
,
function
(
done
)
{
var
self
=
this
;
this
.
UserFields
=
this
.
sequelize
.
define
(
'UserFields'
,
{
emergency_contact
:
{
type
:
DataTypes
.
JSON
,
field
:
'something_else'
}
});
this
.
UserFields
.
sync
({
force
:
true
}).
then
(
function
()
{
self
.
UserFields
.
create
({
emergency_contact
:
{
name
:
'joe'
,
phones
:
[
1337
,
42
]
}
}).
then
(
function
(
user
)
{
user
.
emergency_contact
=
{
name
:
'larry'
};
return
user
.
save
();
}).
then
(
function
(
user
)
{
expect
(
user
.
emergency_contact
.
name
).
to
.
equal
(
'larry'
);
done
();
});
});
});
it
(
'should be able retrieve json value as object'
,
function
()
{
var
self
=
this
;
var
emergencyContact
=
{
name
:
'kate'
,
phone
:
1337
};
...
...
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