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 6340df70
authored
Feb 09, 2014
by
Sohum Banerjea
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tests - correct return, and test for the association pathway
1 parent
1d437cf8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
test/dao-factory/findAll.test.js
test/dao-factory/findAll.test.js
View file @
6340df7
...
...
@@ -102,6 +102,9 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
binary
:
[
this
.
buf
,
this
.
buf
]
}
}).
success
(
function
(
users
){
expect
(
users
).
to
.
have
.
length
(
1
)
expect
(
users
[
0
].
binary
).
to
.
be
.
an
.
instanceof
.
string
expect
(
users
[
0
].
username
).
to
.
equal
(
'boo2'
)
done
();
});
});
...
...
@@ -234,6 +237,60 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it
(
'should be able to handle binary values through associations as well...'
,
function
(
done
)
{
var
User
=
this
.
User
;
var
Binary
=
this
.
sequelize
.
define
(
'Binary'
,
{
id
:
{
type
:
DataTypes
.
STRING
(
16
,
true
),
primaryKey
:
true
}
})
var
buf1
=
this
.
buf
var
buf2
=
new
Buffer
(
16
)
buf2
.
fill
(
'\x02'
)
User
.
belongsTo
(
Binary
,
{
foreignKey
:
'binary'
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
Binary
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
bulkCreate
([
{
username
:
'boo5'
,
aBool
:
false
},
{
username
:
'boo6'
,
aBool
:
true
}
]).
success
(
function
()
{
Binary
.
bulkCreate
([
{
id
:
buf1
},
{
id
:
buf2
}
]).
success
(
function
()
{
User
.
find
(
1
).
success
(
function
(
user
)
{
Binary
.
find
(
buf1
).
success
(
function
(
binary
)
{
user
.
setBinary
(
binary
).
success
(
function
()
{
User
.
find
(
2
).
success
(
function
(
_user
)
{
Binary
.
find
(
buf2
).
success
(
function
(
_binary
)
{
_user
.
setBinary
(
_binary
).
success
(
function
()
{
_user
.
getBinary
().
success
(
function
(
_binaryRetrieved
)
{
user
.
getBinary
().
success
(
function
(
binaryRetrieved
)
{
expect
(
binaryRetrieved
.
id
).
to
.
be
.
an
.
instanceof
.
string
expect
(
_binaryRetrieved
.
id
).
to
.
be
.
an
.
instanceof
.
string
expect
(
binaryRetrieved
.
id
).
to
.
have
.
length
(
16
)
expect
(
_binaryRetrieved
.
id
).
to
.
have
.
length
(
16
)
expect
(
binaryRetrieved
.
id
).
to
.
be
.
equal
(
buf1
.
toString
())
expect
(
_binaryRetrieved
.
id
).
to
.
be
.
equal
(
buf2
.
toString
())
done
()
})
})
})
})
})
})
})
})
})
})
})
})
})
it
(
'should be able to return a record with primaryKey being null for new inserts'
,
function
(
done
)
{
var
Session
=
this
.
sequelize
.
define
(
'Session'
,
{
token
:
{
type
:
DataTypes
.
TEXT
,
allowNull
:
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