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 a30588aa
authored
Apr 15, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(hasOne): expand hasOne getter with transaction unit test
1 parent
bce34621
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
test/associations/has-one.test.js
test/associations/has-one.test.js
View file @
a30588a
...
@@ -29,17 +29,21 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
...
@@ -29,17 +29,21 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
Group
.
hasOne
(
User
)
Group
.
hasOne
(
User
)
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
username
:
'foo'
}).
success
(
function
(
user
)
{
User
.
create
({
username
:
'foo'
}).
success
(
function
(
fakeUser
)
{
Group
.
create
({
name
:
'bar'
}).
success
(
function
(
group
)
{
User
.
create
({
username
:
'foo'
}).
success
(
function
(
user
)
{
sequelize
.
transaction
(
function
(
t
)
{
Group
.
create
({
name
:
'bar'
}).
success
(
function
(
group
)
{
group
.
setUser
(
user
,
{
transaction
:
t
}).
success
(
function
()
{
sequelize
.
transaction
(
function
(
t
)
{
Group
.
all
().
success
(
function
(
groups
)
{
group
.
setUser
(
user
,
{
transaction
:
t
}).
success
(
function
()
{
groups
[
0
].
getUser
().
success
(
function
(
associatedUser
)
{
Group
.
all
().
success
(
function
(
groups
)
{
expect
(
associatedUser
).
to
.
be
.
null
groups
[
0
].
getUser
().
success
(
function
(
associatedUser
)
{
Group
.
all
({
transaction
:
t
}).
success
(
function
(
groups
)
{
expect
(
associatedUser
).
to
.
be
.
null
groups
[
0
].
getUser
({
transaction
:
t
}).
success
(
function
(
associatedUser
)
{
Group
.
all
({
transaction
:
t
}).
success
(
function
(
groups
)
{
expect
(
associatedUser
).
to
.
be
.
not
.
null
groups
[
0
].
getUser
({
transaction
:
t
}).
success
(
function
(
associatedUser
)
{
t
.
rollback
().
success
(
function
()
{
done
()
})
expect
(
associatedUser
).
not
.
to
.
be
.
null
expect
(
associatedUser
.
id
).
to
.
equal
(
user
.
id
)
expect
(
associatedUser
.
id
).
not
.
to
.
equal
(
fakeUser
.
id
)
t
.
rollback
().
success
(
function
()
{
done
()
})
})
})
})
})
})
})
})
...
...
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