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 b4164304
authored
Sep 03, 2010
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed specs
1 parent
974dff97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
29 deletions
test/SequelizeTableTest.js
test/SequelizeTableTest.js
View file @
b416430
...
@@ -15,14 +15,6 @@ module.exports = {
...
@@ -15,14 +15,6 @@ module.exports = {
assert
.
eql
(
day
.
name
,
'asd'
)
assert
.
eql
(
day
.
name
,
'asd'
)
assert
.
isUndefined
(
new
Day
({
name
:
'asd'
,
bla
:
'foo'
}).
bla
)
assert
.
isUndefined
(
new
Day
({
name
:
'asd'
,
bla
:
'foo'
}).
bla
)
},
},
'isCrossAssociatedWith'
:
function
(
assert
)
{
var
Foo
=
s
.
define
(
'Foo'
,
{
bla
:
Sequelize
.
TEXT
})
assert
.
equal
(
Foo
.
isCrossAssociatedWith
(
Day
),
false
)
Foo
.
hasMany
(
'days'
,
Day
)
assert
.
equal
(
Foo
.
isCrossAssociatedWith
(
Day
),
false
)
Day
.
hasMany
(
'foos'
,
Foo
)
assert
.
equal
(
Foo
.
isCrossAssociatedWith
(
Day
),
true
)
},
'prepareAssociations belongsTo'
:
function
(
assert
)
{
'prepareAssociations belongsTo'
:
function
(
assert
)
{
var
s
=
new
Sequelize
(
'sequelize_test'
,
'test'
,
'test'
,
{
disableLogging
:
true
})
var
s
=
new
Sequelize
(
'sequelize_test'
,
'test'
,
'test'
,
{
disableLogging
:
true
})
var
Me
=
s
.
define
(
'Me'
,
{})
var
Me
=
s
.
define
(
'Me'
,
{})
...
@@ -49,18 +41,18 @@ module.exports = {
...
@@ -49,18 +41,18 @@ module.exports = {
assert
.
isNotNull
(
Me
.
attributes
.
you2Id
)
assert
.
isNotNull
(
Me
.
attributes
.
you2Id
)
},
},
'prepareAssociations hasMany'
:
function
(
assert
)
{
'prepareAssociations hasMany'
:
function
(
assert
)
{
var
ManyToManyPart1
=
s
.
define
(
'ManyToManyPart1'
,
{})
var
House
=
s
.
define
(
'House'
,
{})
var
ManyToManyPart2
=
s
.
define
(
'ManyToManyPart2'
,
{})
var
Person
=
s
.
define
(
'Person'
,
{})
ManyToManyPart1
.
hasMany
(
'manyToManyPart2s'
,
ManyToManyPart2
)
ManyToManyPart2
.
hasMany
(
'manyToManyPart1s'
,
ManyToManyPart1
)
ManyToManyPart1
.
prepareAssociations
()
House
.
hasMany
(
'members'
,
Person
,
'households'
)
ManyToManyPart2
.
prepareAssociations
()
House
.
prepareAssociations
()
Person
.
prepareAssociations
()
assert
.
isUndefined
(
ManyToManyPart1
.
attributes
.
manyToManyPart2Id
)
assert
.
isUndefined
(
House
.
attributes
.
personId
)
assert
.
isUndefined
(
ManyToManyPart2
.
attributes
.
manyToManyPart1Id
)
assert
.
isUndefined
(
House
.
attributes
.
membersId
)
assert
.
isUndefined
(
Person
.
attributes
.
houseId
)
assert
.
isDefined
(
s
.
tables
.
ManyToManyPart1sManyToManyPart2
s
)
assert
.
isDefined
(
s
.
tables
.
HouseholdsMember
s
)
},
},
'sync should return the table class'
:
function
(
assert
,
beforeExit
)
{
'sync should return the table class'
:
function
(
assert
,
beforeExit
)
{
var
toBeTested
=
null
var
toBeTested
=
null
...
@@ -148,8 +140,7 @@ module.exports = {
...
@@ -148,8 +140,7 @@ module.exports = {
var
assoc
=
null
var
assoc
=
null
var
Character
=
s
.
define
(
'Character'
,
{})
var
Character
=
s
.
define
(
'Character'
,
{})
var
Word
=
s
.
define
(
'Word'
,
{})
var
Word
=
s
.
define
(
'Word'
,
{})
Character
.
hasMany
(
'Words'
,
Word
)
Character
.
hasMany
(
'Words'
,
Word
,
'Characters'
)
Word
.
hasMany
(
'Characters'
,
Character
)
Sequelize
.
chainQueries
([
Sequelize
.
chainQueries
([
{
drop
:
Character
},
{
drop
:
Word
},
{
prepareAssociations
:
Word
},
{
prepareAssociations
:
Character
},
{
sync
:
Word
},
{
sync
:
Character
}
{
drop
:
Character
},
{
drop
:
Word
},
{
prepareAssociations
:
Word
},
{
prepareAssociations
:
Character
},
{
sync
:
Word
},
{
sync
:
Character
}
...
@@ -293,16 +284,6 @@ module.exports = {
...
@@ -293,16 +284,6 @@ module.exports = {
assert
.
isNull
(
subject
)
assert
.
isNull
(
subject
)
})
})
},
},
'isAssociatedWith'
:
function
(
assert
,
beforeExit
)
{
var
IsAssociatedWithTestOne
=
s
.
define
(
"IsAssociatedWithTestOne"
,
{})
var
IsAssociatedWithTestTwo
=
s
.
define
(
"IsAssociatedWithTestTwo"
,
{})
IsAssociatedWithTestOne
.
belongsTo
(
'foo'
,
IsAssociatedWithTestTwo
)
assert
.
equal
(
true
,
IsAssociatedWithTestOne
.
isAssociatedWith
(
IsAssociatedWithTestTwo
))
assert
.
equal
(
true
,
IsAssociatedWithTestOne
.
isAssociatedWith
(
IsAssociatedWithTestTwo
,
'belongsTo'
))
assert
.
equal
(
false
,
IsAssociatedWithTestOne
.
isAssociatedWith
(
IsAssociatedWithTestTwo
,
'hasMany'
))
assert
.
equal
(
false
,
IsAssociatedWithTestOne
.
isAssociatedWith
(
IsAssociatedWithTestTwo
,
'hasOne'
))
},
'boolean ==> save'
:
function
(
assert
,
beforeExit
)
{
'boolean ==> save'
:
function
(
assert
,
beforeExit
)
{
var
BooleanTest
=
s
.
define
(
"BooleanTest"
,
{
flag
:
Sequelize
.
BOOLEAN
})
var
BooleanTest
=
s
.
define
(
"BooleanTest"
,
{
flag
:
Sequelize
.
BOOLEAN
})
var
testIsFinished
=
false
var
testIsFinished
=
false
...
...
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