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 3c4cbad3
authored
May 11, 2011
by
Vangelis Tsoumenis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test for selective saving.
1 parent
0e11c0ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
test/Model/save.js
test/Model/save.js
View file @
3c4cbad
...
...
@@ -40,5 +40,23 @@ module.exports = {
},
100
)
},
100
)
})
}
,
'save should only update fields in passed-array'
:
function
(
exit
)
{
var
User
=
sequelize
.
define
(
'User'
+
parseInt
(
Math
.
random
()
*
99999999
),
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
User
.
sync
({
force
:
true
}).
on
(
'success'
,
function
()
{
var
u
=
User
.
build
({
name
:
'foo'
,
bio
:
'bar'
});
u
.
save
().
on
(
'success'
,
function
()
{
var
id
=
u
.
id
;
u
.
name
=
'fizz'
;
u
.
bio
=
'buzz'
;
u
.
save
([
'name'
]).
on
(
'success'
,
function
(){
User
.
find
(
id
).
on
(
'success'
,
function
(
u2
){
// re-select user
assert
.
eql
(
'fizz'
,
u2
.
name
);
assert
.
eql
(
'bar'
,
u2
.
bio
);
// bio should be unchanged
exit
(
function
(){});
});
});
})
});
}
}
\ No newline at end of file
}
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