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 670ebd01
authored
Sep 10, 2010
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed specs
1 parent
c1ac2e71
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
18 deletions
test/SequelizeTableTest.js
test/SequelizeTableTest.js
View file @
670ebd0
...
@@ -19,7 +19,8 @@ module.exports = {
...
@@ -19,7 +19,8 @@ module.exports = {
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'
,
{})
var
You
=
s
.
define
(
'You'
,
{})
var
You
=
s
.
define
(
'You'
,
{})
You
.
belongsTo
(
'me'
,
Me
)
var
assoc
=
Me
.
hasOne
(
'you'
,
You
)
You
.
belongsTo
(
'me'
,
Me
,
assoc
)
Me
.
prepareAssociations
()
Me
.
prepareAssociations
()
You
.
prepareAssociations
()
You
.
prepareAssociations
()
...
@@ -28,18 +29,6 @@ module.exports = {
...
@@ -28,18 +29,6 @@ module.exports = {
assert
.
isDefined
(
You
.
attributes
.
meId
)
assert
.
isDefined
(
You
.
attributes
.
meId
)
assert
.
isNotNull
(
You
.
attributes
.
meId
)
assert
.
isNotNull
(
You
.
attributes
.
meId
)
},
},
'prepareAssociations hasOne'
:
function
(
assert
)
{
var
Me
=
s
.
define
(
'Me2'
,
{})
var
You
=
s
.
define
(
'You2'
,
{})
You
.
hasOne
(
'me'
,
Me
)
Me
.
prepareAssociations
()
You
.
prepareAssociations
()
assert
.
includes
(
Sequelize
.
Helper
.
Hash
.
keys
(
Me
.
attributes
),
'you2Id'
)
assert
.
isDefined
(
Me
.
attributes
.
you2Id
)
assert
.
isNotNull
(
Me
.
attributes
.
you2Id
)
},
'prepareAssociations hasMany'
:
function
(
assert
)
{
'prepareAssociations hasMany'
:
function
(
assert
)
{
var
House
=
s
.
define
(
'House'
,
{})
var
House
=
s
.
define
(
'House'
,
{})
var
Person
=
s
.
define
(
'Person'
,
{})
var
Person
=
s
.
define
(
'Person'
,
{})
...
@@ -176,8 +165,8 @@ module.exports = {
...
@@ -176,8 +165,8 @@ module.exports = {
var
Task
=
s2
.
define
(
'Task'
,
{
title
:
Sequelize
.
STRING
})
var
Task
=
s2
.
define
(
'Task'
,
{
title
:
Sequelize
.
STRING
})
var
Deadline
=
s2
.
define
(
'Deadline'
,
{
date
:
Sequelize
.
DATE
})
var
Deadline
=
s2
.
define
(
'Deadline'
,
{
date
:
Sequelize
.
DATE
})
Task
.
hasOne
(
'deadline'
,
Deadline
)
var
taskAssoc
=
Task
.
hasOne
(
'deadline'
,
Deadline
)
Deadline
.
belongsTo
(
'task'
,
Task
)
Deadline
.
belongsTo
(
'task'
,
Task
,
taskAssoc
)
var
task
=
new
Task
({
title
:
'do smth'
})
var
task
=
new
Task
({
title
:
'do smth'
})
var
deadline
=
new
Deadline
({
date
:
new
Date
()})
var
deadline
=
new
Deadline
({
date
:
new
Date
()})
...
@@ -196,7 +185,9 @@ module.exports = {
...
@@ -196,7 +185,9 @@ module.exports = {
},
},
'belongsTo'
:
function
(
assert
)
{
'belongsTo'
:
function
(
assert
)
{
var
BelongsToBlubb
=
s
.
define
(
'BelongsToBlubb'
,
{})
var
BelongsToBlubb
=
s
.
define
(
'BelongsToBlubb'
,
{})
Day
.
belongsTo
(
'BelongsToBlubb'
,
BelongsToBlubb
)
var
Day
=
s
.
define
(
'Day2'
,
{
name
:
Sequelize
.
TEXT
})
var
assoc
=
Day
.
hasOne
(
'asd'
,
BelongsToBlubb
)
Day
.
belongsTo
(
'BelongsToBlubb'
,
BelongsToBlubb
,
assoc
)
assert
.
isDefined
(
new
Day
({
name
:
''
}).
getBelongsToBlubb
)
assert
.
isDefined
(
new
Day
({
name
:
''
}).
getBelongsToBlubb
)
},
},
'belongsTo: set association'
:
function
(
assert
,
beforeExit
)
{
'belongsTo: set association'
:
function
(
assert
,
beforeExit
)
{
...
@@ -205,8 +196,8 @@ module.exports = {
...
@@ -205,8 +196,8 @@ module.exports = {
var
Deadline
=
s2
.
define
(
'Deadline'
,
{
date
:
Sequelize
.
DATE
})
var
Deadline
=
s2
.
define
(
'Deadline'
,
{
date
:
Sequelize
.
DATE
})
var
allowExit
=
false
var
allowExit
=
false
Task
.
hasOne
(
'deadline'
,
Deadline
)
var
assoc
=
Task
.
hasOne
(
'deadline'
,
Deadline
)
Deadline
.
belongsTo
(
'task'
,
Task
)
Deadline
.
belongsTo
(
'task'
,
Task
,
assoc
)
var
task
=
new
Task
({
title
:
'do smth'
})
var
task
=
new
Task
({
title
:
'do smth'
})
var
deadline
=
new
Deadline
({
date
:
new
Date
()})
var
deadline
=
new
Deadline
({
date
:
new
Date
()})
...
...
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