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 bf087b10
authored
Apr 10, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1623 from cusspvz/master
Cleaning unneeded stuff
2 parents
739ed5c6
17e3daf9
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
65 additions
and
120 deletions
test/associations/belongs-to.test.js
test/associations/has-many.test.js
test/associations/has-one.test.js
test/dao-factory/and-or-where.test.js
test/dao-factory/create.test.js
test/dao-factory/find.test.js
test/dao-factory/findAll.test.js
test/dao-factory/scopes.test.js
test/dao.test.js
test/dao/values.test.js
test/include/findAll.test.js
test/include/schema.test.js
test/mysql/associations.test.js
test/mysql/connector-manager.test.js
test/mysql/dao-factory.test.js
test/mysql/query-generator.test.js
test/sqlite/dao-factory.test.js
test/associations/belongs-to.test.js
View file @
bf087b1
...
@@ -61,7 +61,7 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
...
@@ -61,7 +61,7 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
success
(
function
()
{
Task
.
sync
({
force
:
true
}).
success
(
function
()
{
Task
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
username
:
'foo'
,
gender
:
'male'
}).
success
(
function
(
user
)
{
User
.
create
({
username
:
'foo'
,
gender
:
'male'
}).
success
(
function
(
user
)
{
User
.
create
({
username
:
'bar'
,
gender
:
'female'
}).
success
(
function
(
falsePositiveCheck
)
{
User
.
create
({
username
:
'bar'
,
gender
:
'female'
}).
success
(
function
()
{
Task
.
create
({
title
:
'task'
,
status
:
'inactive'
}).
success
(
function
(
task
)
{
Task
.
create
({
title
:
'task'
,
status
:
'inactive'
}).
success
(
function
(
task
)
{
task
.
setUserXYZ
(
user
).
success
(
function
()
{
task
.
setUserXYZ
(
user
).
success
(
function
()
{
task
.
getUserXYZ
({
where
:
[
'gender = ?'
,
'female'
]}).
success
(
function
(
user
)
{
task
.
getUserXYZ
({
where
:
[
'gender = ?'
,
'female'
]}).
success
(
function
(
user
)
{
...
@@ -195,14 +195,14 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
...
@@ -195,14 +195,14 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
Post
.
hasOne
(
Comment
);
Post
.
hasOne
(
Comment
);
Comment
.
belongsTo
(
Post
);
Comment
.
belongsTo
(
Post
);
this
.
sequelize
.
sync
().
done
(
function
(
err
)
{
this
.
sequelize
.
sync
().
done
(
function
()
{
Post
.
create
({
Post
.
create
({
title
:
'Post title'
,
title
:
'Post title'
,
}).
done
(
function
(
err
,
post
)
{
}).
done
(
function
(
err
,
post
)
{
Comment
.
create
({
Comment
.
create
({
text
:
'OLD VALUE'
,
text
:
'OLD VALUE'
,
}).
done
(
function
(
err
,
comment
)
{
}).
done
(
function
(
err
,
comment
)
{
comment
.
setPost
(
post
).
done
(
function
(
err
)
{
comment
.
setPost
(
post
).
done
(
function
()
{
expect
(
comment
.
text
).
to
.
equal
(
'UPDATED VALUE'
);
expect
(
comment
.
text
).
to
.
equal
(
'UPDATED VALUE'
);
done
()
done
()
});
});
...
...
test/associations/has-many.test.js
View file @
bf087b1
...
@@ -117,7 +117,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -117,7 +117,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
describe
(
'hasAll'
,
function
()
{
describe
(
'hasAll'
,
function
()
{
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
var
self
=
this
this
.
Article
=
this
.
sequelize
.
define
(
'Article'
,
{
this
.
Article
=
this
.
sequelize
.
define
(
'Article'
,
{
'title'
:
DataTypes
.
STRING
'title'
:
DataTypes
.
STRING
})
})
...
@@ -332,7 +331,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -332,7 +331,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
Article
.
sync
({
force
:
true
}).
success
(
function
()
{
Article
.
sync
({
force
:
true
}).
success
(
function
()
{
Label
.
sync
({
force
:
true
}).
success
(
function
()
{
Label
.
sync
({
force
:
true
}).
success
(
function
()
{
Article
.
create
({
title
:
'foo'
}).
success
(
function
(
article
)
{
Article
.
create
({
title
:
'foo'
}).
success
(
function
(
article
)
{
article
.
createLabel
({
text
:
'bar'
}).
success
(
function
(
label
)
{
article
.
createLabel
({
text
:
'bar'
}).
success
(
function
()
{
Label
Label
.
findAll
({
where
:
{
ArticleId
:
article
.
id
}})
.
findAll
({
where
:
{
ArticleId
:
article
.
id
}})
...
@@ -377,7 +376,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -377,7 +376,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
})
})
it
(
'supports transactions'
,
function
(
done
)
{
it
(
'supports transactions'
,
function
(
done
)
{
var
self
=
this
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
var
Article
=
sequelize
.
define
(
'Article'
,
{
'title'
:
DataTypes
.
STRING
})
var
Article
=
sequelize
.
define
(
'Article'
,
{
'title'
:
DataTypes
.
STRING
})
,
Label
=
sequelize
.
define
(
'Label'
,
{
'text'
:
DataTypes
.
STRING
})
,
Label
=
sequelize
.
define
(
'Label'
,
{
'text'
:
DataTypes
.
STRING
})
...
@@ -868,7 +866,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -868,7 +866,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
})
})
it
(
'supports transactions'
,
function
(
done
)
{
it
(
'supports transactions'
,
function
(
done
)
{
var
self
=
this
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
DataTypes
.
STRING
})
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
DataTypes
.
STRING
})
,
Task
=
sequelize
.
define
(
'Task'
,
{
title
:
DataTypes
.
STRING
})
,
Task
=
sequelize
.
define
(
'Task'
,
{
title
:
DataTypes
.
STRING
})
...
@@ -928,7 +925,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -928,7 +925,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
describe
(
'optimizations using bulk create, destroy and update'
,
function
()
{
describe
(
'optimizations using bulk create, destroy and update'
,
function
()
{
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
var
self
=
this
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
{
username
:
DataTypes
.
STRING
},
{
timestamps
:
false
})
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
{
username
:
DataTypes
.
STRING
},
{
timestamps
:
false
})
this
.
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
title
:
DataTypes
.
STRING
},
{
timestamps
:
false
})
this
.
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
title
:
DataTypes
.
STRING
},
{
timestamps
:
false
})
...
@@ -1042,7 +1038,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -1042,7 +1038,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
describe
(
'primary key handling for join table'
,
function
()
{
describe
(
'primary key handling for join table'
,
function
()
{
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
var
self
=
this
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
{
username
:
DataTypes
.
STRING
},
{
username
:
DataTypes
.
STRING
},
{
tableName
:
'users'
}
{
tableName
:
'users'
}
...
@@ -1313,7 +1308,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -1313,7 +1308,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
Task
.
findAll
().
done
(
function
(
err
,
tasks
)
{
Task
.
findAll
().
done
(
function
(
err
,
tasks
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
worker
.
setTasks
(
tasks
).
done
(
function
(
err
)
{
worker
.
setTasks
(
tasks
).
done
(
function
()
{
worker
.
setTasks
(
tasks
).
done
(
function
(
err
)
{
worker
.
setTasks
(
tasks
).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
done
()
done
()
...
@@ -1344,7 +1339,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -1344,7 +1339,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
Task
.
findAll
().
done
(
function
(
err
,
tasks
)
{
Task
.
findAll
().
done
(
function
(
err
,
tasks
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
worker
.
setTasks
(
tasks
).
done
(
function
(
err
)
{
worker
.
setTasks
(
tasks
).
done
(
function
()
{
worker
.
removeTask
(
tasks
[
0
]).
done
(
function
(
err
)
{
worker
.
removeTask
(
tasks
[
0
]).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
...
@@ -1462,8 +1457,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -1462,8 +1457,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
})
})
it
(
"correctly identifies its counterpart when through is a string"
,
function
(
done
)
{
it
(
"correctly identifies its counterpart when through is a string"
,
function
(
done
)
{
var
self
=
this
var
User
=
this
.
sequelize
.
define
(
'User'
,
{})
,
User
=
this
.
sequelize
.
define
(
'User'
,
{})
,
Group
=
this
.
sequelize
.
define
(
'Group'
,
{})
,
Group
=
this
.
sequelize
.
define
(
'Group'
,
{})
User
.
hasMany
(
Group
,
{
as
:
'MyGroups'
,
through
:
'group_user'
})
User
.
hasMany
(
Group
,
{
as
:
'MyGroups'
,
through
:
'group_user'
})
...
@@ -1479,8 +1473,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
...
@@ -1479,8 +1473,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
})
})
it
(
"correctly identifies its counterpart when through is a model"
,
function
(
done
)
{
it
(
"correctly identifies its counterpart when through is a model"
,
function
(
done
)
{
var
self
=
this
var
User
=
this
.
sequelize
.
define
(
'User'
,
{})
,
User
=
this
.
sequelize
.
define
(
'User'
,
{})
,
Group
=
this
.
sequelize
.
define
(
'Group'
,
{})
,
Group
=
this
.
sequelize
.
define
(
'Group'
,
{})
,
UserGroup
=
this
.
sequelize
.
define
(
'GroupUser'
,
{},
{
tableName
:
'user_groups'
})
,
UserGroup
=
this
.
sequelize
.
define
(
'GroupUser'
,
{},
{
tableName
:
'user_groups'
})
...
...
test/associations/has-one.test.js
View file @
bf087b1
...
@@ -104,7 +104,6 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
...
@@ -104,7 +104,6 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
it
(
'can set an association with predefined primary keys'
,
function
(
done
)
{
it
(
'can set an association with predefined primary keys'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'UserXYZZ'
,
{
userCoolIdTag
:
{
type
:
Sequelize
.
INTEGER
,
primaryKey
:
true
},
username
:
Sequelize
.
STRING
})
var
User
=
this
.
sequelize
.
define
(
'UserXYZZ'
,
{
userCoolIdTag
:
{
type
:
Sequelize
.
INTEGER
,
primaryKey
:
true
},
username
:
Sequelize
.
STRING
})
,
Task
=
this
.
sequelize
.
define
(
'TaskXYZZ'
,
{
taskOrSomething
:
{
type
:
Sequelize
.
INTEGER
,
primaryKey
:
true
},
title
:
Sequelize
.
STRING
})
,
Task
=
this
.
sequelize
.
define
(
'TaskXYZZ'
,
{
taskOrSomething
:
{
type
:
Sequelize
.
INTEGER
,
primaryKey
:
true
},
title
:
Sequelize
.
STRING
})
,
self
=
this
User
.
hasOne
(
Task
,
{
foreignKey
:
'userCoolIdTag'
})
User
.
hasOne
(
Task
,
{
foreignKey
:
'userCoolIdTag'
})
...
@@ -191,7 +190,7 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
...
@@ -191,7 +190,7 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
username
:
'bob'
}).
success
(
function
(
user
)
{
User
.
create
({
username
:
'bob'
}).
success
(
function
(
user
)
{
sequelize
.
transaction
(
function
(
t
)
{
sequelize
.
transaction
(
function
(
t
)
{
user
.
createGroup
({
name
:
'testgroup'
},
{
transaction
:
t
}).
success
(
function
(
group
)
{
user
.
createGroup
({
name
:
'testgroup'
},
{
transaction
:
t
}).
success
(
function
()
{
User
.
all
().
success
(
function
(
users
)
{
User
.
all
().
success
(
function
(
users
)
{
users
[
0
].
getGroup
().
success
(
function
(
group
)
{
users
[
0
].
getGroup
().
success
(
function
(
group
)
{
expect
(
group
).
to
.
be
.
null
;
expect
(
group
).
to
.
be
.
null
;
...
...
test/dao-factory/and-or-where.test.js
View file @
bf087b1
...
@@ -6,12 +6,7 @@ var chai = require('chai')
...
@@ -6,12 +6,7 @@ var chai = require('chai')
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
async
=
require
(
'async'
)
chai
.
use
(
datetime
)
chai
.
use
(
datetime
)
chai
.
config
.
includeStack
=
true
chai
.
config
.
includeStack
=
true
...
...
test/dao-factory/create.test.js
View file @
bf087b1
...
@@ -6,12 +6,8 @@ var chai = require('chai')
...
@@ -6,12 +6,8 @@ var chai = require('chai')
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
async
=
require
(
'async'
)
chai
.
use
(
datetime
)
chai
.
use
(
datetime
)
chai
.
config
.
includeStack
=
true
chai
.
config
.
includeStack
=
true
...
@@ -35,7 +31,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -35,7 +31,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
describe
(
'findOrCreate'
,
function
()
{
describe
(
'findOrCreate'
,
function
()
{
it
(
"supports transactions"
,
function
(
done
)
{
it
(
"supports transactions"
,
function
(
done
)
{
var
self
=
this
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
var
User
=
sequelize
.
define
(
'user_with_transaction'
,
{
username
:
Sequelize
.
STRING
,
data
:
Sequelize
.
STRING
})
var
User
=
sequelize
.
define
(
'user_with_transaction'
,
{
username
:
Sequelize
.
STRING
,
data
:
Sequelize
.
STRING
})
...
@@ -180,7 +175,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -180,7 +175,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it
(
'supports transactions'
,
function
(
done
)
{
it
(
'supports transactions'
,
function
(
done
)
{
var
self
=
this
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
var
User
=
sequelize
.
define
(
'user_with_transaction'
,
{
username
:
Sequelize
.
STRING
})
var
User
=
sequelize
.
define
(
'user_with_transaction'
,
{
username
:
Sequelize
.
STRING
})
...
@@ -697,7 +691,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -697,7 +691,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'should allow blank creates (with timestamps: false)'
,
function
(
done
)
{
it
(
'should allow blank creates (with timestamps: false)'
,
function
(
done
)
{
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
Worker
.
sync
().
done
(
function
(
err
)
{
Worker
.
sync
().
done
(
function
()
{
Worker
.
create
({},
{
fields
:
[]}).
done
(
function
(
err
,
worker
)
{
Worker
.
create
({},
{
fields
:
[]}).
done
(
function
(
err
,
worker
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
worker
).
to
.
be
.
ok
expect
(
worker
).
to
.
be
.
ok
...
@@ -708,7 +702,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -708,7 +702,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'should allow truly blank creates'
,
function
(
done
)
{
it
(
'should allow truly blank creates'
,
function
(
done
)
{
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
Worker
.
sync
().
done
(
function
(
err
)
{
Worker
.
sync
().
done
(
function
()
{
Worker
.
create
({},
{
fields
:
[]}).
done
(
function
(
err
,
worker
)
{
Worker
.
create
({},
{
fields
:
[]}).
done
(
function
(
err
,
worker
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
worker
).
to
.
be
.
ok
expect
(
worker
).
to
.
be
.
ok
...
@@ -791,7 +785,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -791,7 +785,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
(
_item
)
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
()
{
done
()
done
()
});
});
});
});
...
@@ -803,7 +797,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -803,7 +797,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
(
_item
)
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
()
{
done
()
done
()
});
});
});
});
...
@@ -819,7 +813,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -819,7 +813,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
(
_item
)
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
()
{
done
()
done
()
});
});
});
});
...
@@ -833,14 +827,14 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -833,14 +827,14 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
sync
({
force
:
true
}).
success
(
function
()
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
(
_item
)
{
Enum
.
create
({
state
:
'happy'
}).
success
(
function
()
{
done
()
done
()
});
});
});
});
})
})
})
})
describe
(
'can safely sync multiple times'
,
function
(
done
)
{
describe
(
'can safely sync multiple times'
,
function
()
{
it
(
'through the factory'
,
function
(
done
)
{
it
(
'through the factory'
,
function
(
done
)
{
var
Enum
=
this
.
sequelize
.
define
(
'Enum'
,
{
var
Enum
=
this
.
sequelize
.
define
(
'Enum'
,
{
state
:
{
state
:
{
...
@@ -1095,7 +1089,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1095,7 +1089,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'should allow blank arrays (return immediatly)'
,
function
(
done
)
{
it
(
'should allow blank arrays (return immediatly)'
,
function
(
done
)
{
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{})
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{})
Worker
.
sync
().
done
(
function
(
err
)
{
Worker
.
sync
().
done
(
function
()
{
Worker
.
bulkCreate
([]).
done
(
function
(
err
,
workers
)
{
Worker
.
bulkCreate
([]).
done
(
function
(
err
,
workers
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
workers
).
to
.
be
.
ok
expect
(
workers
).
to
.
be
.
ok
...
@@ -1107,7 +1101,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1107,7 +1101,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'should allow blank creates (with timestamps: false)'
,
function
(
done
)
{
it
(
'should allow blank creates (with timestamps: false)'
,
function
(
done
)
{
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
Worker
.
sync
().
done
(
function
(
err
)
{
Worker
.
sync
().
done
(
function
()
{
Worker
.
bulkCreate
([{},
{}]).
done
(
function
(
err
,
workers
)
{
Worker
.
bulkCreate
([{},
{}]).
done
(
function
(
err
,
workers
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
workers
).
to
.
be
.
ok
expect
(
workers
).
to
.
be
.
ok
...
@@ -1118,7 +1112,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1118,7 +1112,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'should allow autoincremented attributes to be set'
,
function
(
done
)
{
it
(
'should allow autoincremented attributes to be set'
,
function
(
done
)
{
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
Worker
.
sync
().
done
(
function
(
err
)
{
Worker
.
sync
().
done
(
function
()
{
Worker
.
bulkCreate
([
Worker
.
bulkCreate
([
{
id
:
5
},
{
id
:
5
},
{
id
:
10
}
{
id
:
10
}
...
...
test/dao-factory/find.test.js
View file @
bf087b1
...
@@ -5,12 +5,9 @@ var chai = require('chai')
...
@@ -5,12 +5,9 @@ var chai = require('chai')
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
async
=
require
(
'async'
)
,
async
=
require
(
'async'
)
chai
.
use
(
datetime
)
chai
.
use
(
datetime
)
...
@@ -79,7 +76,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -79,7 +76,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'does not modify the passed arguments'
,
function
(
done
)
{
it
(
'does not modify the passed arguments'
,
function
(
done
)
{
var
options
=
{
where
:
[
'specialkey = ?'
,
'awesome'
]}
var
options
=
{
where
:
[
'specialkey = ?'
,
'awesome'
]}
this
.
UserPrimary
.
find
(
options
).
success
(
function
(
user
)
{
this
.
UserPrimary
.
find
(
options
).
success
(
function
()
{
expect
(
options
).
to
.
deep
.
equal
({
where
:
[
'specialkey = ?'
,
'awesome'
]})
expect
(
options
).
to
.
deep
.
equal
({
where
:
[
'specialkey = ?'
,
'awesome'
]})
done
()
done
()
})
})
...
@@ -101,7 +98,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -101,7 +98,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
})
})
xit
(
'doesn\'t throw an error when entering in a non integer value'
,
function
(
done
)
{
it
.
skip
(
'doesn\'t throw an error when entering in a non integer value'
,
function
(
done
)
{
this
.
User
.
find
(
'a string value'
).
success
(
function
(
user
)
{
this
.
User
.
find
(
'a string value'
).
success
(
function
(
user
)
{
expect
(
user
).
to
.
be
.
null
expect
(
user
).
to
.
be
.
null
done
()
done
()
...
@@ -218,7 +215,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -218,7 +215,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
UserPrimary
.
create
({
UserPrimary
.
create
({
id
:
'a string based id'
,
id
:
'a string based id'
,
name
:
'Johnno'
name
:
'Johnno'
}).
success
(
function
(
u
)
{
}).
success
(
function
()
{
UserPrimary
.
find
(
'a string based id'
).
success
(
function
(
u2
)
{
UserPrimary
.
find
(
'a string based id'
).
success
(
function
(
u2
)
{
expect
(
u2
.
id
).
to
.
equal
(
'a string based id'
)
expect
(
u2
.
id
).
to
.
equal
(
'a string based id'
)
expect
(
u2
.
name
).
to
.
equal
(
'Johnno'
)
expect
(
u2
.
name
).
to
.
equal
(
'Johnno'
)
...
@@ -420,8 +417,8 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -420,8 +417,8 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
this
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
this
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
username
:
'test_testerson'
}).
success
(
function
(
user
)
{
User
.
create
({
username
:
'test_testerson'
}).
success
(
function
(
user
)
{
Message
.
create
({
user_id
:
user
.
id
,
message
:
'hi there!'
}).
success
(
function
(
message
)
{
Message
.
create
({
user_id
:
user
.
id
,
message
:
'hi there!'
}).
success
(
function
()
{
Message
.
create
({
user_id
:
user
.
id
,
message
:
'a second message'
}).
success
(
function
(
message
)
{
Message
.
create
({
user_id
:
user
.
id
,
message
:
'a second message'
}).
success
(
function
()
{
Message
.
findAll
({
Message
.
findAll
({
where
:
{
user_id
:
user
.
id
},
where
:
{
user_id
:
user
.
id
},
...
@@ -546,7 +543,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -546,7 +543,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
done
()
done
()
})
})
describe
(
'alias'
,
function
(
done
)
{
describe
(
'alias'
,
function
()
{
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
var
self
=
this
var
self
=
this
this
.
Worker
.
hasOne
(
this
.
Task
,
{
as
:
'ToDo'
})
this
.
Worker
.
hasOne
(
this
.
Task
,
{
as
:
'ToDo'
})
...
@@ -654,9 +651,9 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -654,9 +651,9 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
self
.
Photo
.
create
({
img
:
'img.jpg'
}).
success
(
function
(
somePhoto
)
{
self
.
Photo
.
create
({
img
:
'img.jpg'
}).
success
(
function
(
somePhoto
)
{
self
.
PhoneNumber
.
create
({
phone
:
'000000'
}).
success
(
function
(
somePhone1
)
{
self
.
PhoneNumber
.
create
({
phone
:
'000000'
}).
success
(
function
(
somePhone1
)
{
self
.
PhoneNumber
.
create
({
phone
:
'111111'
}).
success
(
function
(
somePhone2
)
{
self
.
PhoneNumber
.
create
({
phone
:
'111111'
}).
success
(
function
(
somePhone2
)
{
someContact
.
setPhotos
([
somePhoto
]).
complete
(
function
(
err
,
data
)
{
someContact
.
setPhotos
([
somePhoto
]).
complete
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
null
expect
(
err
).
to
.
be
.
null
someContact
.
setPhoneNumbers
([
somePhone1
,
somePhone2
]).
complete
(
function
(
err
,
data
)
{
someContact
.
setPhoneNumbers
([
somePhone1
,
somePhone2
]).
complete
(
function
()
{
self
.
Contact
.
find
({
self
.
Contact
.
find
({
where
:
{
where
:
{
name
:
'Boris'
name
:
'Boris'
...
@@ -698,7 +695,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -698,7 +695,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
self
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
User
.
create
({
username
:
'someone'
}).
success
(
function
(
someUser
)
{
self
.
User
.
create
({
username
:
'someone'
}).
success
(
function
(
someUser
)
{
self
.
Group
.
create
({
name
:
'people'
}).
success
(
function
(
someGroup
)
{
self
.
Group
.
create
({
name
:
'people'
}).
success
(
function
(
someGroup
)
{
someUser
.
setGroupPKeagerones
([
someGroup
]).
complete
(
function
(
err
,
data
)
{
someUser
.
setGroupPKeagerones
([
someGroup
]).
complete
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
null
expect
(
err
).
to
.
be
.
null
self
.
User
.
find
({
self
.
User
.
find
({
where
:
{
where
:
{
...
@@ -803,7 +800,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -803,7 +800,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
this
.
Product
.
hasMany
(
this
.
Tag
,
{
as
:
'Tags'
,
through
:
'product_tag'
})
this
.
Product
.
hasMany
(
this
.
Tag
,
{
as
:
'Tags'
,
through
:
'product_tag'
})
this
.
Tag
.
hasMany
(
this
.
Product
,
{
as
:
'Products'
,
through
:
'product_tag'
})
this
.
Tag
.
hasMany
(
this
.
Product
,
{
as
:
'Products'
,
through
:
'product_tag'
})
this
.
sequelize
.
sync
().
done
(
function
(
err
)
{
this
.
sequelize
.
sync
().
done
(
function
()
{
async
.
auto
({
async
.
auto
({
createProducts
:
function
(
callback
)
{
createProducts
:
function
(
callback
)
{
self
.
Product
.
bulkCreate
([
self
.
Product
.
bulkCreate
([
...
...
test/dao-factory/findAll.test.js
View file @
bf087b1
...
@@ -7,7 +7,6 @@ var chai = require('chai')
...
@@ -7,7 +7,6 @@ var chai = require('chai')
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
moment
=
require
(
'moment'
)
...
@@ -62,7 +61,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -62,7 +61,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
describe
(
'special where conditions/smartWhere object'
,
function
()
{
describe
(
'special where conditions/smartWhere object'
,
function
()
{
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
var
self
=
this
this
.
buf
=
new
Buffer
(
16
);
this
.
buf
=
new
Buffer
(
16
);
this
.
buf
.
fill
(
'\x01'
);
this
.
buf
.
fill
(
'\x01'
);
...
@@ -70,7 +68,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -70,7 +68,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
this
.
User
.
bulkCreate
([
this
.
User
.
bulkCreate
([
{
username
:
'boo'
,
intVal
:
5
,
theDate
:
'2013-01-01 12:00'
},
{
username
:
'boo'
,
intVal
:
5
,
theDate
:
'2013-01-01 12:00'
},
{
username
:
'boo2'
,
intVal
:
10
,
theDate
:
'2013-01-10 12:00'
,
binary
:
this
.
buf
}
{
username
:
'boo2'
,
intVal
:
10
,
theDate
:
'2013-01-10 12:00'
,
binary
:
this
.
buf
}
]).
success
(
function
(
user2
)
{
]).
success
(
function
()
{
done
()
done
()
})
})
})
})
...
@@ -91,7 +89,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -91,7 +89,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
where
:
{
where
:
{
id
:
[
1
,
2
,
3
]
id
:
[
1
,
2
,
3
]
}
}
}).
success
(
function
(
users
){
}).
success
(
function
(){
done
();
done
();
});
});
})
})
...
@@ -1225,7 +1223,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1225,7 +1223,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it
(
'does not modify the passed arguments'
,
function
(
done
)
{
it
(
'does not modify the passed arguments'
,
function
(
done
)
{
var
options
=
{
where
:
[
'username = ?'
,
'awesome'
]}
var
options
=
{
where
:
[
'username = ?'
,
'awesome'
]}
this
.
User
.
findAll
(
options
).
success
(
function
(
user
)
{
this
.
User
.
findAll
(
options
).
success
(
function
()
{
expect
(
options
).
to
.
deep
.
equal
({
where
:
[
'username = ?'
,
'awesome'
]})
expect
(
options
).
to
.
deep
.
equal
({
where
:
[
'username = ?'
,
'awesome'
]})
done
()
done
()
})
})
...
...
test/dao-factory/scopes.test.js
View file @
bf087b1
...
@@ -5,13 +5,7 @@ var chai = require('chai')
...
@@ -5,13 +5,7 @@ var chai = require('chai')
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
async
=
require
(
'async'
)
chai
.
use
(
datetime
)
chai
.
use
(
datetime
)
chai
.
config
.
includeStack
=
true
chai
.
config
.
includeStack
=
true
...
...
test/dao.test.js
View file @
bf087b1
...
@@ -156,7 +156,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -156,7 +156,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
})
})
// In my opinion this is bad logic, null is different from an empty string
// In my opinion this is bad logic, null is different from an empty string
xit
(
"returns false for two empty attributes"
,
function
(
done
)
{
it
.
skip
(
"returns false for two empty attributes"
,
function
(
done
)
{
this
.
User
.
create
({
username
:
null
}).
success
(
function
(
user
)
{
this
.
User
.
create
({
username
:
null
}).
success
(
function
(
user
)
{
user
.
username
=
''
user
.
username
=
''
expect
(
user
.
isDirty
).
to
.
be
.
false
expect
(
user
.
isDirty
).
to
.
be
.
false
...
...
test/dao/values.test.js
View file @
bf087b1
...
@@ -4,12 +4,7 @@ var chai = require('chai')
...
@@ -4,12 +4,7 @@ var chai = require('chai')
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
uuid
=
require
(
'node-uuid'
)
,
_
=
require
(
'lodash'
)
chai
.
use
(
datetime
)
chai
.
use
(
datetime
)
chai
.
config
.
includeStack
=
true
chai
.
config
.
includeStack
=
true
...
@@ -205,7 +200,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -205,7 +200,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
price
:
{
price
:
{
type
:
Sequelize
.
FLOAT
,
type
:
Sequelize
.
FLOAT
,
get
:
function
()
{
get
:
function
()
{
return
this
.
dataValues
[
'price'
]
*
100
return
this
.
dataValues
.
price
*
100
}
}
}
}
})
})
...
@@ -224,7 +219,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -224,7 +219,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
},
{
},
{
getterMethods
:
{
getterMethods
:
{
price
:
function
()
{
price
:
function
()
{
return
this
.
dataValues
[
'priceInCents'
]
/
100
return
this
.
dataValues
.
priceInCents
/
100
}
}
}
}
})
})
...
@@ -240,7 +235,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -240,7 +235,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
price
:
{
price
:
{
type
:
Sequelize
.
STRING
,
type
:
Sequelize
.
STRING
,
get
:
function
()
{
get
:
function
()
{
return
this
.
dataValues
[
'price'
]
*
100
return
this
.
dataValues
.
price
*
100
}
}
}
}
},
{
},
{
...
@@ -283,8 +278,6 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -283,8 +278,6 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
contact
.
save
().
done
(
function
(
err
,
me
)
{
contact
.
save
().
done
(
function
(
err
,
me
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
var
idToTest
=
me
.
id
;
expect
(
me
.
get
(
'tags'
)).
to
.
deep
.
equal
([
'yes'
,
'no'
])
expect
(
me
.
get
(
'tags'
)).
to
.
deep
.
equal
([
'yes'
,
'no'
])
done
();
done
();
});
});
...
@@ -298,7 +291,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -298,7 +291,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
name
:
{
type
:
DataTypes
.
STRING
}
name
:
{
type
:
DataTypes
.
STRING
}
})
})
User
.
sync
().
done
(
function
(
err
)
{
User
.
sync
().
done
(
function
()
{
User
.
create
({
name
:
'Jan Meier'
}).
done
(
function
(
err
,
user
)
{
User
.
create
({
name
:
'Jan Meier'
}).
done
(
function
(
err
,
user
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
user
.
changed
(
'name'
)).
to
.
be
.
false
expect
(
user
.
changed
(
'name'
)).
to
.
be
.
false
...
@@ -328,7 +321,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -328,7 +321,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
name
:
{
type
:
DataTypes
.
STRING
}
name
:
{
type
:
DataTypes
.
STRING
}
})
})
User
.
sync
().
done
(
function
(
err
)
{
User
.
sync
().
done
(
function
()
{
var
user
=
User
.
build
({
var
user
=
User
.
build
({
name
:
'Jan Meier'
name
:
'Jan Meier'
})
})
...
...
test/include/findAll.test.js
View file @
bf087b1
...
@@ -5,12 +5,7 @@ var chai = require('chai')
...
@@ -5,12 +5,7 @@ var chai = require('chai')
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
async
=
require
(
'async'
)
,
async
=
require
(
'async'
)
chai
.
use
(
datetime
)
chai
.
use
(
datetime
)
...
@@ -398,7 +393,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -398,7 +393,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
]
]
}).
done
(
function
(
err
,
users
)
{
}).
done
(
function
(
err
,
users
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
users
.
forEach
(
function
(
user
,
i
)
{
users
.
forEach
(
function
(
user
)
{
user
.
memberships
.
sort
(
sortById
)
user
.
memberships
.
sort
(
sortById
)
expect
(
user
.
memberships
.
length
).
to
.
equal
(
2
)
expect
(
user
.
memberships
.
length
).
to
.
equal
(
2
)
...
@@ -473,9 +468,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -473,9 +468,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
},
},
singleChain
:
function
(
callback
)
{
singleChain
:
function
(
callback
)
{
var
previousInstance
var
previousInstance
,
previousModel
async
.
eachSeries
(
singles
,
function
(
model
,
callback
,
i
)
{
async
.
eachSeries
(
singles
,
function
(
model
,
callback
)
{
model
.
create
({}).
done
(
function
(
err
,
instance
)
{
model
.
create
({}).
done
(
function
(
err
,
instance
)
{
if
(
previousInstance
)
{
if
(
previousInstance
)
{
previousInstance
[
"set"
+
model
.
name
](
instance
).
done
(
function
()
{
previousInstance
[
"set"
+
model
.
name
](
instance
).
done
(
function
()
{
...
@@ -666,7 +660,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -666,7 +660,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
Product
.
findAll
({
Product
.
findAll
({
...
@@ -716,7 +710,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -716,7 +710,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
userGroups
:
[
'users'
,
'groups'
,
function
(
callback
,
results
)
{
userGroups
:
[
'users'
,
'groups'
,
function
(
callback
,
results
)
{
results
.
users
[
2
].
setGroup
(
results
.
groups
[
1
]).
done
(
callback
)
results
.
users
[
2
].
setGroup
(
results
.
groups
[
1
]).
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -762,7 +756,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -762,7 +756,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -809,7 +803,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -809,7 +803,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -874,7 +868,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -874,7 +868,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -944,7 +938,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -944,7 +938,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -1014,7 +1008,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -1014,7 +1008,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -1066,7 +1060,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -1066,7 +1060,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
add
(
results
.
users
[
0
].
setLeaderOf
(
results
.
projects
[
0
]))
chainer
.
add
(
results
.
users
[
0
].
setLeaderOf
(
results
.
projects
[
0
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -1132,7 +1126,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -1132,7 +1126,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
Product
.
findAll
({
Product
.
findAll
({
...
@@ -1361,7 +1355,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -1361,7 +1355,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer
.
add
(
results
.
users
[
3
].
setGroup
(
results
.
groups
[
1
]))
chainer
.
add
(
results
.
users
[
3
].
setGroup
(
results
.
groups
[
1
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
...
test/include/schema.test.js
View file @
bf087b1
...
@@ -5,12 +5,7 @@ var chai = require('chai')
...
@@ -5,12 +5,7 @@ var chai = require('chai')
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
sinon
=
require
(
'sinon'
)
,
datetime
=
require
(
'chai-datetime'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
async
=
require
(
'async'
)
,
async
=
require
(
'async'
)
chai
.
use
(
datetime
)
chai
.
use
(
datetime
)
...
@@ -125,7 +120,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -125,7 +120,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
{
name
:
'Admin'
,
canInvite
:
1
,
canRemove
:
1
,
canPost
:
1
},
{
name
:
'Admin'
,
canInvite
:
1
,
canRemove
:
1
,
canPost
:
1
},
{
name
:
'Trustee'
,
canInvite
:
1
,
canRemove
:
0
,
canPost
:
1
},
{
name
:
'Trustee'
,
canInvite
:
1
,
canRemove
:
0
,
canPost
:
1
},
{
name
:
'Member'
,
canInvite
:
1
,
canRemove
:
0
,
canPost
:
0
}
{
name
:
'Member'
,
canInvite
:
1
,
canRemove
:
0
,
canPost
:
0
}
]).
done
(
function
(
err
)
{
]).
done
(
function
()
{
Rank
.
findAll
().
done
(
callback
)
Rank
.
findAll
().
done
(
callback
)
})
})
},
},
...
@@ -407,7 +402,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -407,7 +402,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
]
]
}).
done
(
function
(
err
,
users
)
{
}).
done
(
function
(
err
,
users
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
users
.
forEach
(
function
(
user
,
i
)
{
users
.
forEach
(
function
(
user
)
{
expect
(
user
.
memberships
).
to
.
be
.
ok
expect
(
user
.
memberships
).
to
.
be
.
ok
user
.
memberships
.
sort
(
sortById
)
user
.
memberships
.
sort
(
sortById
)
...
@@ -485,9 +480,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -485,9 +480,8 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
},
},
singleChain
:
function
(
callback
)
{
singleChain
:
function
(
callback
)
{
var
previousInstance
var
previousInstance
,
previousModel
async
.
eachSeries
(
singles
,
function
(
model
,
callback
,
i
)
{
async
.
eachSeries
(
singles
,
function
(
model
,
callback
)
{
model
.
create
({}).
done
(
function
(
err
,
instance
)
{
model
.
create
({}).
done
(
function
(
err
,
instance
)
{
if
(
previousInstance
)
{
if
(
previousInstance
)
{
previousInstance
[
"set"
+
model
.
name
](
instance
).
done
(
function
()
{
previousInstance
[
"set"
+
model
.
name
](
instance
).
done
(
function
()
{
...
@@ -678,7 +672,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -678,7 +672,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
Product
.
findAll
({
Product
.
findAll
({
...
@@ -728,7 +722,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -728,7 +722,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
userGroups
:
[
'users'
,
'groups'
,
function
(
callback
,
results
)
{
userGroups
:
[
'users'
,
'groups'
,
function
(
callback
,
results
)
{
results
.
users
[
2
].
setGroup
(
results
.
groups
[
1
]).
done
(
callback
)
results
.
users
[
2
].
setGroup
(
results
.
groups
[
1
]).
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -774,7 +768,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -774,7 +768,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -821,7 +815,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -821,7 +815,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
add
(
results
.
users
[
1
].
setGroup
(
results
.
groups
[
0
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -885,7 +879,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -885,7 +879,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -955,7 +949,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -955,7 +949,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -1025,7 +1019,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -1025,7 +1019,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -1077,7 +1071,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -1077,7 +1071,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
add
(
results
.
users
[
0
].
setLeaderOf
(
results
.
projects
[
0
]))
chainer
.
add
(
results
.
users
[
0
].
setLeaderOf
(
results
.
projects
[
0
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -1143,7 +1137,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -1143,7 +1137,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
Product
.
findAll
({
Product
.
findAll
({
...
@@ -1372,7 +1366,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -1372,7 +1366,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
chainer
.
add
(
results
.
users
[
3
].
setGroup
(
results
.
groups
[
1
]))
chainer
.
add
(
results
.
users
[
3
].
setGroup
(
results
.
groups
[
1
]))
chainer
.
run
().
done
(
callback
)
chainer
.
run
().
done
(
callback
)
}]
}]
},
function
(
err
,
results
)
{
},
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
err
).
not
.
to
.
be
.
ok
User
.
findAll
({
User
.
findAll
({
...
@@ -1480,7 +1474,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -1480,7 +1474,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
})
})
})
})
xit
(
'should support including date fields, with the correct timeszone'
,
function
(
done
)
{
it
.
skip
(
'should support including date fields, with the correct timeszone'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'user'
,
{
var
User
=
this
.
sequelize
.
define
(
'user'
,
{
dateField
:
Sequelize
.
DATE
dateField
:
Sequelize
.
DATE
},
{
timestamps
:
false
,
schema
:
"account"
})
},
{
timestamps
:
false
,
schema
:
"account"
})
...
...
test/mysql/associations.test.js
View file @
bf087b1
var
chai
=
require
(
'chai'
)
var
chai
=
require
(
'chai'
)
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
dialect
=
Support
.
getTestDialect
()
,
sinon
=
require
(
'sinon'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
chai
.
config
.
includeStack
=
true
chai
.
config
.
includeStack
=
true
...
...
test/mysql/connector-manager.test.js
View file @
bf087b1
var
chai
=
require
(
'chai'
)
var
chai
=
require
(
'chai'
)
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
dialect
=
Support
.
getTestDialect
()
,
sinon
=
require
(
'sinon'
)
,
sinon
=
require
(
'sinon'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
...
...
test/mysql/dao-factory.test.js
View file @
bf087b1
...
@@ -3,7 +3,6 @@ var chai = require('chai')
...
@@ -3,7 +3,6 @@ var chai = require('chai')
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
DataTypes
=
require
(
__dirname
+
"/../../lib/data-types"
)
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
"/../config/config"
)
,
config
=
require
(
__dirname
+
"/../config/config"
)
chai
.
config
.
includeStack
=
true
chai
.
config
.
includeStack
=
true
...
...
test/mysql/query-generator.test.js
View file @
bf087b1
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
var
chai
=
require
(
'chai'
)
var
chai
=
require
(
'chai'
)
,
expect
=
chai
.
expect
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
dialect
=
Support
.
getTestDialect
()
,
util
=
require
(
"util"
)
,
_
=
require
(
'lodash'
)
,
_
=
require
(
'lodash'
)
,
QueryGenerator
=
require
(
"../../lib/dialects/mysql/query-generator"
)
,
QueryGenerator
=
require
(
"../../lib/dialects/mysql/query-generator"
)
...
...
test/sqlite/dao-factory.test.js
View file @
bf087b1
...
@@ -124,7 +124,7 @@ if (dialect === 'sqlite') {
...
@@ -124,7 +124,7 @@ if (dialect === 'sqlite') {
})
})
})
})
xit
(
"should make aliased attributes available"
,
function
(
done
)
{
it
.
skip
(
"should make aliased attributes available"
,
function
(
done
)
{
this
.
User
.
find
({
where
:
{
name
:
'user'
},
attributes
:
[
'id'
,
[
'name'
,
'username'
]]
}).
success
(
function
(
user
)
{
this
.
User
.
find
({
where
:
{
name
:
'user'
},
attributes
:
[
'id'
,
[
'name'
,
'username'
]]
}).
success
(
function
(
user
)
{
expect
(
user
.
username
).
to
.
equal
(
'user'
)
expect
(
user
.
username
).
to
.
equal
(
'user'
)
done
()
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