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 20684b4e
authored
Aug 29, 2013
by
Lemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Association columns type tests
1 parent
ba10473f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
test/associations/belongs-to.test.js
test/associations/has-one.test.js
test/associations/belongs-to.test.js
View file @
20684b4
...
...
@@ -192,6 +192,31 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
})
})
describe
(
"Association column"
,
function
()
{
it
(
'has correct type for non-id primary keys with non-integer type'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'UserPKBT'
,
{
username
:
{
type
:
DataTypes
.
STRING
}
})
,
self
=
this
var
Group
=
this
.
sequelize
.
define
(
'GroupPKBT'
,
{
name
:
{
type
:
DataTypes
.
STRING
,
primaryKey
:
true
}
})
User
.
belongsTo
(
Group
)
self
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
expect
(
User
.
rawAttributes
.
GroupPKBTId
.
type
.
toString
()).
to
.
equal
(
DataTypes
.
STRING
.
toString
())
done
()
})
})
})
describe
(
"Association options"
,
function
()
{
it
(
'can specify data type for autogenerated relational keys'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'UserXYZ'
,
{
username
:
DataTypes
.
STRING
})
...
...
test/associations/has-one.test.js
View file @
20684b4
...
...
@@ -229,6 +229,31 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
})
describe
(
"Association column"
,
function
()
{
it
(
'has correct type for non-id primary keys with non-integer type'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'UserPKBT'
,
{
username
:
{
type
:
Sequelize
.
STRING
}
})
,
self
=
this
var
Group
=
this
.
sequelize
.
define
(
'GroupPKBT'
,
{
name
:
{
type
:
Sequelize
.
STRING
,
primaryKey
:
true
}
})
Group
.
hasOne
(
User
)
self
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
expect
(
User
.
rawAttributes
.
GroupPKBTId
.
type
.
toString
()).
to
.
equal
(
Sequelize
.
STRING
.
toString
())
done
()
})
})
})
describe
(
"Association options"
,
function
()
{
it
(
'can specify data type for autogenerated relational keys'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'UserXYZ'
,
{
username
:
Sequelize
.
STRING
})
...
...
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