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 b68e5345
authored
Mar 08, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
1 parent
2c3f4dd3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
37 deletions
lib/dao-factory.js
test/dao.test.js
lib/dao-factory.js
View file @
b68e534
...
...
@@ -671,6 +671,12 @@ module.exports = (function() {
}
options
=
options
||
{
isNewRecord
:
true
,
isDirty
:
true
}
if
(
options
.
attributes
)
{
options
.
attributes
=
options
.
attributes
.
map
(
function
(
attribute
)
{
return
Array
.
isArray
(
attribute
)
?
attribute
[
1
]
:
attribute
})
}
if
(
options
.
hasOwnProperty
(
'include'
)
&&
options
.
include
&&
!
options
.
includeValidated
)
{
validateIncludedElements
.
call
(
this
,
options
)
}
...
...
@@ -685,6 +691,12 @@ module.exports = (function() {
validateIncludedElements
.
call
(
this
,
options
)
}
if
(
options
.
attributes
)
{
options
.
attributes
=
options
.
attributes
.
map
(
function
(
attribute
)
{
return
Array
.
isArray
(
attribute
)
?
attribute
[
1
]
:
attribute
})
}
return
valueSets
.
map
(
function
(
values
)
{
return
this
.
build
(
values
,
options
)
}.
bind
(
this
))
...
...
test/dao.test.js
View file @
b68e534
...
...
@@ -1050,43 +1050,6 @@ 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