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 8cb31290
authored
Feb 05, 2015
by
Willyham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start adding tests
1 parent
971c1ab0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletions
lib/dialects/abstract/connection-manager.js
test/integration/dialects/abstract/connection-manager.test.js
lib/dialects/abstract/connection-manager.js
View file @
8cb3129
...
...
@@ -19,7 +19,7 @@ ConnectionManager = function(dialect, sequelize) {
this
.
dialect
=
dialect
;
if
(
config
.
pool
)
{
config
.
pool
=
_
.
extend
({},
config
.
pool
);
// Make sure we don't modify the existing config object (user might re-use it)
config
.
pool
=
_
.
clone
(
config
.
pool
);
// Make sure we don't modify the existing config object (user might re-use it)
config
.
pool
=
_
.
defaults
(
config
.
pool
,
defaultPoolingConfig
,
{
validate
:
this
.
$validate
.
bind
(
this
)
})
;
...
...
test/integration/dialects/abstract/connection-manager.test.js
0 → 100644
View file @
8cb3129
'use strict'
;
var
chai
=
require
(
'chai'
)
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../../support'
)
,
sinon
=
require
(
'sinon'
)
,
Config
=
require
(
__dirname
+
'/../../../config/config'
)
,
ConnectionManager
=
require
(
__dirname
+
'/../../../../lib/dialects/abstract/connection-manager'
)
,
Pooling
=
require
(
'generic-pool'
);
chai
.
config
.
includeStack
=
true
;
var
baseConf
=
Config
[
Support
.
getTestDialect
()];
describe
(
'Connction Manager'
,
function
()
{
var
sandbox
;
beforeEach
(
function
(){
sandbox
=
sinon
.
sandbox
.
create
();
});
afterEach
(
function
(){
sandbox
.
restore
();
});
it
(
'should initialize a single pool without replication'
,
function
()
{
var
options
=
{
pool
:
{}
};
var
sequelize
=
Support
.
getSequelizeInstance
(
baseConf
.
database
,
baseConf
.
username
,
baseConf
.
password
,
options
);
var
connectionManager
=
new
ConnectionManager
(
Support
.
getTestDialect
(),
sequelize
);
var
poolSpy
=
sinon
.
spy
(
Pooling
,
"Pool"
);
connectionManager
.
initPools
();
expect
(
poolSpy
.
calledOnce
).
to
.
be
.
true
;
});
});
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