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 fffd1a39
authored
Jun 23, 2015
by
Fred K. Schott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add breaking test for upsert and default values
1 parent
3015c2fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletions
test/integration/model/upsert.test.js
test/integration/model/upsert.test.js
View file @
fffd1a3
...
@@ -24,7 +24,8 @@ describe(Support.getTestDialectTeaser('Model'), function() {
...
@@ -24,7 +24,8 @@ describe(Support.getTestDialectTeaser('Model'), function() {
},
},
baz
:
{
baz
:
{
type
:
DataTypes
.
STRING
,
type
:
DataTypes
.
STRING
,
field
:
'zab'
field
:
'zab'
,
defaultValue
:
'BAZ_DEFAULT_VALUE'
},
},
blob
:
DataTypes
.
BLOB
blob
:
DataTypes
.
BLOB
});
});
...
@@ -248,6 +249,25 @@ describe(Support.getTestDialectTeaser('Model'), function() {
...
@@ -248,6 +249,25 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
});
});
it
(
'does not update using default values'
,
function
()
{
return
this
.
User
.
create
({
id
:
42
,
username
:
'john'
,
baz
:
'new baz value'
}).
bind
(
this
).
then
(
function
()
{
return
this
.
User
.
findById
(
42
);
}).
then
(
function
(
user
)
{
// 'username' should be 'john' since it was set
expect
(
user
.
username
).
to
.
equal
(
'john'
);
// 'baz' should be 'new baz value' since it was set
expect
(
user
.
baz
).
to
.
equal
(
'new baz value'
);
return
this
.
User
.
upsert
({
id
:
42
,
username
:
'doe'
});
}).
then
(
function
()
{
return
this
.
User
.
findById
(
42
);
}).
then
(
function
(
user
)
{
// 'username' was updated
expect
(
user
.
username
).
to
.
equal
(
'doe'
);
// 'baz' should still be 'new baz value' since it was not updated
expect
(
user
.
baz
).
to
.
equal
(
'new baz value'
);
});
});
});
});
}
}
});
});
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