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 a59c409e
authored
Oct 21, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't execute tests for every dialect but only for one per test run
1 parent
28f334e9
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
50 additions
and
37 deletions
changelog.md
package.json
spec/associations/belongs-to.spec.js
spec/associations/has-many.spec.js
spec/associations/has-one.spec.js
spec/associations/mixin.spec.js
spec/dao-factory.spec.js
spec/dao.spec.js
spec/dao.validations.spec.js
spec/query-chainer.spec.js
spec/sequelize.spec.js
spec/sqlite/dao.spec.js
changelog.md
View file @
a59c409
# v1.6.0 #
# v1.6.0 #
-
[
DEPENDENCIES
]
upgraded most dependencies. most important: mysql was upgraded to 2.0.0-alpha-3
-
[
DEPENDENCIES
]
upgraded most dependencies. most important: mysql was upgraded to 2.0.0-alpha-3
-
[
REFACTORING
]
separated tests for dialects
-
[
BUG
]
fixed wrong version in sequelize binary
-
[
BUG
]
fixed wrong version in sequelize binary
-
[
FEATURE
]
added association prefetching for find and findAll
-
[
FEATURE
]
added association prefetching for find and findAll
-
[
FEATURE
]
it's now possible to use callbacks of async functions inside migrations (thanks to mphilpot)
-
[
FEATURE
]
it's now possible to use callbacks of async functions inside migrations (thanks to mphilpot)
-
[
FEATURE
]
improved comfort of sequelize.query. just pass an sql string to it and wait for the result
-
[
FEATURE
]
improved comfort of sequelize.query. just pass an sql string to it and wait for the result
-
[
FEATURE
]
Migrations now understand NODE_ENV (thanks to gavri)
-
[
FEATURE
]
Migrations now understand NODE_ENV (thanks to gavri)
-
[
FEATURE
]
# v1.5.0 #
# v1.5.0 #
-
[
REFACTORING
]
use underscore functions for Utils.isHash (thanks to Mick-Hansen/innofluence)
-
[
REFACTORING
]
use underscore functions for Utils.isHash (thanks to Mick-Hansen/innofluence)
...
...
package.json
View file @
a59c409
...
@@ -48,7 +48,10 @@
...
@@ -48,7 +48,10 @@
"scripts"
:
{
"scripts"
:
{
"test"
:
"npm run test-jasmine && npm run test-buster"
,
"test"
:
"npm run test-jasmine && npm run test-buster"
,
"test-jasmine"
:
"./node_modules/.bin/jasmine-node spec-jasmine/"
,
"test-jasmine"
:
"./node_modules/.bin/jasmine-node spec-jasmine/"
,
"test-buster"
:
"./node_modules/.bin/buster-test"
,
"test-buster"
:
"npm run test-buster-mysql && npm run test-buster-postgres && npm run test-buster-sqlite"
,
"test-buster-mysql"
:
"DIALECT=mysql ./node_modules/.bin/buster-test"
,
"test-buster-postgres"
:
"DIALECT=postgres ./node_modules/.bin/buster-test"
,
"test-buster-sqlite"
:
"DIALECT=sqlite ./node_modules/.bin/buster-test"
,
"generate-docs"
:
"node_modules/.bin/dox-foundation --source ./lib --title Sequelize"
"generate-docs"
:
"node_modules/.bin/dox-foundation --source ./lib --title Sequelize"
},
},
"bin"
:
{
"bin"
:
{
...
...
spec/associations/belongs-to.spec.js
View file @
a59c409
...
@@ -2,14 +2,13 @@ if (typeof require === 'function') {
...
@@ -2,14 +2,13 @@ if (typeof require === 'function') {
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Sequelize
=
require
(
'../../index'
)
,
Sequelize
=
require
(
'../../index'
)
,
dialect
s
=
Helpers
.
getSupportedDialects
()
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
buster
.
testRunner
.
timeout
=
500
buster
.
testRunner
.
timeout
=
500
dialects
.
forEach
(
function
(
dialect
)
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] BelongsTo"
,
function
()
{
describe
(
'BelongsTo@'
+
dialect
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
Helpers
.
initTests
({
Helpers
.
initTests
({
beforeComplete
:
function
(
sequelize
)
{
beforeComplete
:
function
(
sequelize
)
{
...
@@ -47,5 +46,4 @@ dialects.forEach(function(dialect) {
...
@@ -47,5 +46,4 @@ dialects.forEach(function(dialect) {
})
})
})
})
})
})
})
})
})
spec/associations/has-many.spec.js
View file @
a59c409
...
@@ -2,14 +2,13 @@ if (typeof require === 'function') {
...
@@ -2,14 +2,13 @@ if (typeof require === 'function') {
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Sequelize
=
require
(
'../../index'
)
,
Sequelize
=
require
(
'../../index'
)
,
dialect
s
=
Helpers
.
getSupportedDialects
()
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
buster
.
testRunner
.
timeout
=
500
buster
.
testRunner
.
timeout
=
500
dialects
.
forEach
(
function
(
dialect
)
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] HasMany"
,
function
()
{
describe
(
'HasMany@'
+
dialect
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
var
self
=
this
var
self
=
this
...
@@ -324,5 +323,4 @@ dialects.forEach(function(dialect) {
...
@@ -324,5 +323,4 @@ dialects.forEach(function(dialect) {
})
})
})
})
})
})
})
})
})
spec/associations/has-one.spec.js
View file @
a59c409
...
@@ -2,14 +2,13 @@ if (typeof require === 'function') {
...
@@ -2,14 +2,13 @@ if (typeof require === 'function') {
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
Sequelize
=
require
(
"../../index"
)
,
Sequelize
=
require
(
"../../index"
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
dialect
s
=
Helpers
.
getSupportedDialects
()
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
buster
.
testRunner
.
timeout
=
500
buster
.
testRunner
.
timeout
=
500
dialects
.
forEach
(
function
(
dialect
)
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] HasOne"
,
function
()
{
describe
(
'HasOne@'
+
dialect
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
var
self
=
this
var
self
=
this
...
@@ -48,5 +47,4 @@ dialects.forEach(function(dialect) {
...
@@ -48,5 +47,4 @@ dialects.forEach(function(dialect) {
})
})
})
})
})
})
})
})
})
spec/associations/mixin.spec.js
View file @
a59c409
...
@@ -2,13 +2,12 @@ if (typeof require === 'function') {
...
@@ -2,13 +2,12 @@ if (typeof require === 'function') {
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Sequelize
=
require
(
'../../index'
)
,
Sequelize
=
require
(
'../../index'
)
,
dialect
s
=
Helpers
.
getSupportedDialects
()
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
dialects
.
forEach
(
function
(
dialect
)
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] Mixin"
,
function
()
{
describe
(
'Mixin@'
+
dialect
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
Helpers
.
initTests
({
Helpers
.
initTests
({
dialect
:
dialect
,
dialect
:
dialect
,
...
@@ -30,5 +29,4 @@ dialects.forEach(function(dialect) {
...
@@ -30,5 +29,4 @@ dialects.forEach(function(dialect) {
expect
(
User
.
getAssociation
(
Task
).
target
).
toEqual
(
Task
)
expect
(
User
.
getAssociation
(
Task
).
target
).
toEqual
(
Task
)
})
})
})
})
})
})
})
spec/dao-factory.spec.js
View file @
a59c409
...
@@ -2,13 +2,12 @@ if(typeof require === 'function') {
...
@@ -2,13 +2,12 @@ if(typeof require === 'function') {
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
Sequelize
=
require
(
"../index"
)
,
Sequelize
=
require
(
"../index"
)
,
Helpers
=
require
(
'./buster-helpers'
)
,
Helpers
=
require
(
'./buster-helpers'
)
,
dialect
s
=
Helpers
.
getSupportedDialects
()
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
dialects
.
forEach
(
function
(
dialect
)
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] DAOFactory"
,
function
()
{
describe
(
'DAOFactory@'
+
dialect
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
Helpers
.
initTests
({
Helpers
.
initTests
({
dialect
:
dialect
,
dialect
:
dialect
,
...
@@ -20,7 +19,7 @@ dialects.forEach(function(dialect) {
...
@@ -20,7 +19,7 @@ dialects.forEach(function(dialect) {
data
:
DataTypes
.
STRING
data
:
DataTypes
.
STRING
})
})
}.
bind
(
this
),
}.
bind
(
this
),
onComplete
:
function
(
sequelize
)
{
onComplete
:
function
(
)
{
this
.
User
.
sync
({
force
:
true
}).
success
(
done
)
this
.
User
.
sync
({
force
:
true
}).
success
(
done
)
}.
bind
(
this
)
}.
bind
(
this
)
})
})
...
@@ -365,6 +364,20 @@ dialects.forEach(function(dialect) {
...
@@ -365,6 +364,20 @@ dialects.forEach(function(dialect) {
})
})
})
})
it
(
'//returns the selected fields as instance.selectedValues'
,
function
(
done
)
{
this
.
User
.
create
({
username
:
'JohnXOXOXO'
}).
success
(
function
()
{
this
.
User
.
find
({
where
:
{
username
:
'JohnXOXOXO'
},
select
:
[
'username'
]
}).
success
(
function
(
user
)
{
expect
(
user
.
selectedValues
).
toEqual
({
username
:
'JohnXOXOXO'
})
done
()
})
}.
bind
(
this
))
})
describe
(
'association fetching'
,
function
()
{
describe
(
'association fetching'
,
function
()
{
before
(
function
()
{
before
(
function
()
{
this
.
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
this
.
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
...
@@ -532,6 +545,8 @@ dialects.forEach(function(dialect) {
...
@@ -532,6 +545,8 @@ dialects.forEach(function(dialect) {
}.
bind
(
this
))
//- sequelize.sync
}.
bind
(
this
))
//- sequelize.sync
})
})
})
})
})
//- describe: find
})
//- describe: find
describe
(
'findAll'
,
function
findAll
()
{
describe
(
'findAll'
,
function
findAll
()
{
...
@@ -761,5 +776,4 @@ dialects.forEach(function(dialect) {
...
@@ -761,5 +776,4 @@ dialects.forEach(function(dialect) {
})
})
})
})
})
//- describe: max
})
//- describe: max
})
})
})
spec/dao.spec.js
View file @
a59c409
if
(
typeof
require
===
'function'
)
{
if
(
typeof
require
===
'function'
)
{
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
dialects
=
[
'sqlite'
,
'mysql'
,
'postgres'
]
,
Helpers
=
require
(
'./buster-helpers'
)
,
Helpers
=
require
(
'./buster-helpers'
)
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
dialects
.
forEach
(
function
(
dialect
)
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] DAO"
,
function
()
{
describe
(
'DAO@'
+
dialect
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
var
self
=
this
var
self
=
this
...
@@ -21,7 +20,7 @@ dialects.forEach(function(dialect) {
...
@@ -21,7 +20,7 @@ dialects.forEach(function(dialect) {
aNumber
:
{
type
:
DataTypes
.
INTEGER
}
aNumber
:
{
type
:
DataTypes
.
INTEGER
}
})
})
},
},
onComplete
:
function
(
sequelize
)
{
onComplete
:
function
(
)
{
self
.
User
.
sync
({
force
:
true
}).
success
(
done
)
self
.
User
.
sync
({
force
:
true
}).
success
(
done
)
}
}
})
})
...
@@ -99,5 +98,4 @@ dialects.forEach(function(dialect) {
...
@@ -99,5 +98,4 @@ dialects.forEach(function(dialect) {
expect
(
JSON
.
parse
(
JSON
.
stringify
(
user
))).
toEqual
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
,
id
:
null
})
expect
(
JSON
.
parse
(
JSON
.
stringify
(
user
))).
toEqual
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
,
id
:
null
})
})
})
})
})
})
})
})
spec/dao.validations.spec.js
View file @
a59c409
...
@@ -7,8 +7,7 @@ if(typeof require === 'function') {
...
@@ -7,8 +7,7 @@ if(typeof require === 'function') {
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
describe
(
dialect
,
function
()
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] DAO"
,
function
()
{
describe
(
'=>DAO'
,
function
()
{
describe
(
'validations'
,
function
()
{
describe
(
'validations'
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
Helpers
.
initTests
({
Helpers
.
initTests
({
...
@@ -264,5 +263,4 @@ describe(dialect, function() {
...
@@ -264,5 +263,4 @@ describe(dialect, function() {
expect
(
successfulUser
.
validate
()).
toBeNull
()
expect
(
successfulUser
.
validate
()).
toBeNull
()
})
})
})
})
})
})
})
spec/query-chainer.spec.js
View file @
a59c409
...
@@ -2,13 +2,14 @@ if(typeof require === 'function') {
...
@@ -2,13 +2,14 @@ if(typeof require === 'function') {
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
QueryChainer
=
require
(
"../lib/query-chainer"
)
,
QueryChainer
=
require
(
"../lib/query-chainer"
)
,
CustomEventEmitter
=
require
(
"../lib/emitters/custom-event-emitter"
)
,
CustomEventEmitter
=
require
(
"../lib/emitters/custom-event-emitter"
)
,
Helpers
=
require
(
'./buster-helpers'
)
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
buster
.
testRunner
.
timeout
=
1000
buster
.
testRunner
.
timeout
=
1000
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] QueryChainer"
,
function
()
{
describe
(
'QueryChainer'
,
function
()
{
before
(
function
()
{
before
(
function
()
{
this
.
queryChainer
=
new
QueryChainer
()
this
.
queryChainer
=
new
QueryChainer
()
})
})
...
...
spec/sequelize.spec.js
View file @
a59c409
if
(
typeof
require
===
'function'
)
{
if
(
typeof
require
===
'function'
)
{
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
Helpers
=
require
(
'./buster-helpers'
)
,
Helpers
=
require
(
'./buster-helpers'
)
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
describe
(
'Sequelize'
,
function
()
{
describe
(
"["
+
dialect
.
toUpperCase
()
+
"] Sequelize"
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
Helpers
.
initTests
({
Helpers
.
initTests
({
beforeComplete
:
function
(
sequelize
)
{
this
.
sequelize
=
sequelize
}.
bind
(
this
),
beforeComplete
:
function
(
sequelize
)
{
this
.
sequelize
=
sequelize
}.
bind
(
this
),
...
@@ -44,7 +46,7 @@ describe('Sequelize', function() {
...
@@ -44,7 +46,7 @@ describe('Sequelize', function() {
})
})
})
})
it
(
'executes a query if only the sql is passed'
,
function
(
done
)
{
it
(
'
//
executes a query if only the sql is passed'
,
function
(
done
)
{
this
.
sequelize
.
query
(
this
.
insertQuery
).
success
(
function
(
result
)
{
this
.
sequelize
.
query
(
this
.
insertQuery
).
success
(
function
(
result
)
{
expect
(
result
).
toBeNull
()
expect
(
result
).
toBeNull
()
done
()
done
()
...
...
spec/sqlite/dao.spec.js
View file @
a59c409
if
(
typeof
require
===
'function'
)
{
if
(
typeof
require
===
'function'
)
{
const
buster
=
require
(
"buster"
)
const
buster
=
require
(
"buster"
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
Helpers
=
require
(
'../buster-helpers'
)
,
dialect
=
Helpers
.
getTestDialect
()
}
}
buster
.
spec
.
expose
()
buster
.
spec
.
expose
()
describe
(
'DAO@sqlite'
,
function
()
{
if
(
dialect
===
'sqlite'
)
{
describe
(
'[SQLITE] DAO'
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
var
self
=
this
var
self
=
this
...
@@ -18,7 +20,7 @@ describe('DAO@sqlite', function() {
...
@@ -18,7 +20,7 @@ describe('DAO@sqlite', function() {
username
:
DataTypes
.
STRING
username
:
DataTypes
.
STRING
})
})
},
},
onComplete
:
function
(
sequelize
)
{
onComplete
:
function
(
)
{
self
.
User
.
sync
({
force
:
true
}).
success
(
done
)
self
.
User
.
sync
({
force
:
true
}).
success
(
done
)
}
}
})
})
...
@@ -47,4 +49,5 @@ describe('DAO@sqlite', function() {
...
@@ -47,4 +49,5 @@ describe('DAO@sqlite', function() {
})
})
})
})
})
})
})
})
}
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