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 72392dcd
authored
Sep 22, 2010
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added basic test for fetching associations
1 parent
720e40fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
test/Table/fetchAssociations.js
test/Table/fetchAssociations.js
View file @
72392dc
...
@@ -5,14 +5,26 @@ var Sequelize = require(__dirname + "/../../lib/sequelize/Sequelize").Sequelize,
...
@@ -5,14 +5,26 @@ var Sequelize = require(__dirname + "/../../lib/sequelize/Sequelize").Sequelize,
module
.
exports
=
{
module
.
exports
=
{
'should
store data inside the fetchedAssociations hash
'
:
function
(
assert
,
beforeExit
)
{
'should
have no fetchedAssociations first
'
:
function
(
assert
,
beforeExit
)
{
var
allowExit
=
false
var
allowExit
=
false
Foo
.
hasMany
(
'bars'
,
Bar
,
'foos'
)
Foo
.
hasMany
(
'bars'
,
Bar
,
'foos'
)
Sequelize
.
chainQueries
([{
drop
:
s
},
{
sync
:
s
}],
function
()
{
Sequelize
.
chainQueries
([{
drop
:
s
},
{
sync
:
s
}],
function
()
{
var
foo
=
new
Foo
({
name
:
'asd'
})
new
Foo
({
name
:
'asd'
}).
save
(
function
()
{
foo
.
save
(
function
()
{
assert
.
eql
(
foo
.
fetchedAssociations
,
{})
assert
.
eql
(
foo
.
fetchedAssociations
,
{})
allowExit
=
true
})
})
beforeExit
(
function
()
{
assert
.
eql
(
allowExit
,
true
)
})
},
'should have an empty array for each table association'
:
function
(
assert
,
beforeExit
)
{
var
allowExit
=
false
Foo
.
hasMany
(
'bars'
,
Bar
,
'foos'
)
Sequelize
.
chainQueries
([{
drop
:
s
},
{
sync
:
s
}],
function
()
{
new
Foo
({
name
:
'asd'
}).
save
(
function
()
{
foo
.
fetchAssociations
(
function
()
{
foo
.
fetchAssociations
(
function
()
{
assert
.
eql
(
foo
.
fetchedAssociations
,
{
bars
:
[]})
assert
.
eql
(
foo
.
fetchedAssociations
,
{
bars
:
[]})
allowExit
=
true
allowExit
=
true
...
...
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