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 52dbeb3b
authored
Jul 26, 2015
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(btm/timestamps) Tests for #3792
1 parent
be653528
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletions
lib/associations/mixin.js
test/unit/associations/belongs-to-many.test.js
lib/associations/mixin.js
View file @
52dbeb3
...
...
@@ -292,7 +292,6 @@ Mixin.belongsToMany = function(targetModel, options) { // testhint options:none
options
.
hooks
=
options
.
hooks
===
undefined
?
false
:
Boolean
(
options
.
hooks
);
options
.
useHooks
=
options
.
hooks
;
options
.
timestamps
=
options
.
timestamps
===
undefined
?
this
.
sequelize
.
options
.
timestamps
:
options
.
timestamps
;
options
=
_
.
extend
(
options
,
_
.
omit
(
sourceModel
.
options
,
[
'hooks'
,
'timestamps'
]));
// the id is in the foreign table or in a connecting table
...
...
test/unit/associations/belongs-to-many.test.js
View file @
52dbeb3
...
...
@@ -14,6 +14,39 @@ var chai = require('chai')
,
Promise
=
current
.
Promise
;
describe
(
Support
.
getTestDialectTeaser
(
'belongsToMany'
),
function
()
{
describe
(
'timestamps'
,
function
()
{
it
(
'follows the global timestamps true option'
,
function
()
{
var
User
=
current
.
define
(
'User'
,
{})
,
Task
=
current
.
define
(
'Task'
,
{});
User
.
belongsToMany
(
Task
,
{
through
:
'user_task1'
});
expect
(
current
.
models
.
user_task1
.
rawAttributes
).
to
.
contain
.
all
.
keys
([
'createdAt'
,
'updatedAt'
]);
});
it
(
'allows me to override the global timestamps option'
,
function
()
{
var
User
=
current
.
define
(
'User'
,
{})
,
Task
=
current
.
define
(
'Task'
,
{});
User
.
belongsToMany
(
Task
,
{
through
:
'user_task2'
,
timestamps
:
false
});
expect
(
current
.
models
.
user_task2
.
rawAttributes
).
not
.
to
.
contain
.
all
.
keys
([
'createdAt'
,
'updatedAt'
]);
});
it
(
'follows the global timestamps false option'
,
function
()
{
var
current
=
Support
.
createSequelizeInstance
({
timestamps
:
false
});
var
User
=
current
.
define
(
'User'
,
{})
,
Task
=
current
.
define
(
'Task'
,
{});
User
.
belongsToMany
(
Task
,
{
through
:
'user_task3'
});
expect
(
current
.
models
.
user_task3
.
rawAttributes
).
not
.
to
.
have
.
all
.
keys
([
'createdAt'
,
'updatedAt'
]);
});
});
describe
(
'optimizations using bulk create, destroy and update'
,
function
()
{
var
User
=
current
.
define
(
'User'
,
{
username
:
DataTypes
.
STRING
})
,
Task
=
current
.
define
(
'Task'
,
{
title
:
DataTypes
.
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