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 a923048f
authored
Mar 28, 2016
by
Sushant
Committed by
Jan Aagaard Meier
May 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(tests) fixed cases which assume default dialect
1 parent
0ec26180
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
26 deletions
test/integration/configuration.test.js
test/integration/error.test.js
test/integration/hooks/hooks.test.js
test/integration/sequelize.test.js
test/integration/sequelize/log.test.js
test/integration/configuration.test.js
View file @
a923048
...
...
@@ -56,8 +56,8 @@ describe(Support.getTestDialectTeaser('Configuration'), function() {
it
(
'when we don\'t have a valid dialect.'
,
function
()
{
expect
(
function
()
{
new
Sequelize
(
config
[
dialect
].
database
,
config
[
dialect
].
username
,
config
[
dialect
].
password
,
{
host
:
'0.0.0.1'
,
port
:
config
[
dialect
].
port
,
dialect
:
undefined
});
}).
to
.
throw
(
Error
,
'The dialect
undefined
is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite.'
);
new
Sequelize
(
config
[
dialect
].
database
,
config
[
dialect
].
username
,
config
[
dialect
].
password
,
{
host
:
'0.0.0.1'
,
port
:
config
[
dialect
].
port
,
dialect
:
'some-fancy-dialect'
});
}).
to
.
throw
(
Error
,
'The dialect
some-fancy-dialect
is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite.'
);
});
});
...
...
@@ -113,26 +113,10 @@ describe(Support.getTestDialectTeaser('Configuration'), function() {
});
describe
(
'Instantiation with arguments'
,
function
()
{
it
(
'should accept two parameters (database, username)'
,
function
()
{
var
sequelize
=
new
Sequelize
(
'dbname'
,
'root'
);
var
config
=
sequelize
.
config
;
expect
(
config
.
database
).
to
.
equal
(
'dbname'
);
expect
(
config
.
username
).
to
.
equal
(
'root'
);
});
it
(
'should accept three parameters (database, username, password)'
,
function
()
{
var
sequelize
=
new
Sequelize
(
'dbname'
,
'root'
,
'pass'
);
var
config
=
sequelize
.
config
;
expect
(
config
.
database
).
to
.
equal
(
'dbname'
);
expect
(
config
.
username
).
to
.
equal
(
'root'
);
expect
(
config
.
password
).
to
.
equal
(
'pass'
);
});
it
(
'should accept four parameters (database, username, password, options)'
,
function
()
{
var
sequelize
=
new
Sequelize
(
'dbname'
,
'root'
,
'pass'
,
{
port
:
999
,
dialect
:
dialect
,
dialectOptions
:
{
supportBigNumbers
:
true
,
bigNumberStrings
:
true
...
...
@@ -144,6 +128,7 @@ describe(Support.getTestDialectTeaser('Configuration'), function() {
expect
(
config
.
username
).
to
.
equal
(
'root'
);
expect
(
config
.
password
).
to
.
equal
(
'pass'
);
expect
(
config
.
port
).
to
.
equal
(
999
);
expect
(
sequelize
.
options
.
dialect
).
to
.
equal
(
dialect
);
expect
(
config
.
dialectOptions
.
supportBigNumbers
).
to
.
be
.
true
;
expect
(
config
.
dialectOptions
.
bigNumberStrings
).
to
.
be
.
true
;
});
...
...
test/integration/error.test.js
View file @
a923048
...
...
@@ -14,7 +14,7 @@ describe(Support.getTestDialectTeaser('Sequelize Errors'), function () {
it
(
'Should have the Error constructors exposed'
,
function
()
{
expect
(
Sequelize
).
to
.
have
.
property
(
'Error'
);
expect
(
Sequelize
).
to
.
have
.
property
(
'ValidationError'
);
var
sequelize
=
new
Sequelize
();
var
sequelize
=
new
Sequelize
(
'mysql://user:pass@example.com:9821/dbname'
);
expect
(
sequelize
).
to
.
have
.
property
(
'Error'
);
expect
(
sequelize
).
to
.
have
.
property
(
'ValidationError'
);
});
...
...
@@ -27,7 +27,7 @@ describe(Support.getTestDialectTeaser('Sequelize Errors'), function () {
,
new
errors
.
ValidationErrorItem
(
'<field name> cannot be an array or an object'
,
'string violation'
,
'<field name>'
,
null
)
]);
var
sequelize
=
new
Sequelize
();
var
sequelize
=
new
Sequelize
(
'mysql://user:pass@example.com:9821/dbname'
);
var
instError
=
new
sequelize
.
Error
();
var
instValidationError
=
new
sequelize
.
ValidationError
();
...
...
test/integration/hooks/hooks.test.js
View file @
a923048
...
...
@@ -6,6 +6,7 @@ var chai = require('chai')
,
Support
=
require
(
__dirname
+
'/../support'
)
,
DataTypes
=
require
(
__dirname
+
'/../../../lib/data-types'
)
,
Sequelize
=
Support
.
Sequelize
,
dialect
=
Support
.
getTestDialect
()
,
sinon
=
require
(
'sinon'
);
describe
(
Support
.
getTestDialectTeaser
(
'Hooks'
),
function
()
{
...
...
@@ -82,7 +83,7 @@ describe(Support.getTestDialectTeaser('Hooks'), function() {
sequelize
.
options
.
protocol
=
'udp'
;
});
this
.
seq
=
new
Sequelize
(
'db'
,
'user'
,
'pass'
,
{});
this
.
seq
=
new
Sequelize
(
'db'
,
'user'
,
'pass'
,
{
dialect
:
dialect
});
});
it
(
'beforeInit hook can alter config'
,
function
()
{
...
...
test/integration/sequelize.test.js
View file @
a923048
...
...
@@ -162,6 +162,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
it
(
'triggers the error event when using replication'
,
function
()
{
return
new
Sequelize
(
'sequelize'
,
null
,
null
,
{
dialect
:
dialect
,
replication
:
{
read
:
{
host
:
'localhost'
,
...
...
test/integration/sequelize/log.test.js
View file @
a923048
...
...
@@ -4,7 +4,8 @@
var
chai
=
require
(
'chai'
)
,
sinon
=
require
(
'sinon'
)
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
);
,
Support
=
require
(
__dirname
+
'/../support'
)
,
dialect
=
Support
.
getTestDialect
();
describe
(
Support
.
getTestDialectTeaser
(
'Sequelize'
),
function
()
{
describe
(
'log'
,
function
()
{
...
...
@@ -18,7 +19,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
describe
(
'with disabled logging'
,
function
()
{
beforeEach
(
function
()
{
this
.
sequelize
=
new
Support
.
Sequelize
(
'db'
,
'user'
,
'pw'
,
{
logging
:
false
});
this
.
sequelize
=
new
Support
.
Sequelize
(
'db'
,
'user'
,
'pw'
,
{
dialect
:
dialect
,
logging
:
false
});
});
it
(
'does not call the log method of the logger'
,
function
()
{
...
...
@@ -29,7 +30,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
describe
(
'with default logging options'
,
function
()
{
beforeEach
(
function
()
{
this
.
sequelize
=
new
Support
.
Sequelize
(
'db'
,
'user'
,
'pw'
);
this
.
sequelize
=
new
Support
.
Sequelize
(
'db'
,
'user'
,
'pw'
,
{
dialect
:
dialect
}
);
});
describe
(
'called with no arguments'
,
function
()
{
...
...
@@ -62,7 +63,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
describe
(
'with a custom function for logging'
,
function
()
{
beforeEach
(
function
()
{
this
.
spy
=
sinon
.
spy
();
this
.
sequelize
=
new
Support
.
Sequelize
(
'db'
,
'user'
,
'pw'
,
{
logging
:
this
.
spy
});
this
.
sequelize
=
new
Support
.
Sequelize
(
'db'
,
'user'
,
'pw'
,
{
dialect
:
dialect
,
logging
:
this
.
spy
});
});
it
(
'calls the custom logger method'
,
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