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 b2cbb01f
authored
Mar 08, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'milestones/2.0.0'
2 parents
dd3cd4be
33fca3f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
test/dao.test.js
test/dao.test.js
View file @
b2cbb01
...
...
@@ -1050,6 +1050,43 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
})
})
})
describe
(
'many to many relations'
,
function
()
{
var
udo
;
beforeEach
(
function
(
done
)
{
var
self
=
this
this
.
User
=
this
.
sequelize
.
define
(
'UserWithUsernameAndAgeAndIsAdmin'
,
{
username
:
DataTypes
.
STRING
,
age
:
DataTypes
.
INTEGER
,
isAdmin
:
DataTypes
.
BOOLEAN
},
{
timestamps
:
false
})
this
.
Project
=
this
.
sequelize
.
define
(
'NiceProject'
,
{
title
:
DataTypes
.
STRING
},
{
timestamps
:
false
})
this
.
Project
.
hasMany
(
this
.
User
)
this
.
User
.
hasMany
(
this
.
Project
)
this
.
User
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
Project
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
User
.
create
({
username
:
'fnord'
,
age
:
1
,
isAdmin
:
true
})
.
success
(
function
(
user
)
{
udo
=
user
done
()
})
})
})
})
it
(
'Should assign a property to the instance'
,
function
(
done
)
{
var
self
=
this
;
this
.
User
.
find
({
id
:
udo
.
id
})
.
success
(
function
(
user
)
{
user
.
NiceProjectId
=
1
;
expect
(
user
.
NiceProjectId
).
to
.
equal
(
1
);
done
();
})
})
})
describe
(
'toJSON'
,
function
()
{
beforeEach
(
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