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 87dbb148
authored
Nov 10, 2011
by
Meg Sharkey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test
1 parent
d8cfd984
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
13 deletions
package.json
spec/associations.spec.js
spec/config/config.js
test/config.js
package.json
View file @
87dbb14
{
{
"name"
:
"s
eque
lize"
,
"name"
:
"s
q
lize"
,
"description"
:
"MySQL ORM for Node.JS"
,
"description"
:
"M
odified version of sequelize - M
ySQL ORM for Node.JS"
,
"version"
:
"
1.2
.0"
,
"version"
:
"
0.1
.0"
,
"author"
:
"
Sascha Depold <sascha@depold
.com>"
,
"author"
:
"
Meg Sharkey <meg@metamx
.com>"
,
"contributors"
:
[
"contributors"
:
[
{
"name"
:
"Sascha Depold"
,
"email"
:
"sascha@depold.com"
}
{
"name"
:
"Sascha Depold"
,
"email"
:
"sascha@depold.com"
},
{
"name"
:
"Meg Sharkey"
,
"email"
:
"meg@metamx.com"
}
],
],
"dependencies"
:
{
"dependencies"
:
{
"mysql"
:
"=0.9.4"
,
"mysql"
:
"=0.9.4"
,
...
@@ -16,7 +17,7 @@
...
@@ -16,7 +17,7 @@
"jasmine-node"
:
"=1.0.12"
,
"jasmine-node"
:
"=1.0.12"
,
"expresso"
:
"=0.9.2"
"expresso"
:
"=0.9.2"
},
},
"keywords"
:
[
"mysql"
,
"orm"
,
"nodejs"
,
"object relational mapper"
],
"keywords"
:
[],
"main"
:
"index"
,
"main"
:
"index"
,
"scripts"
:
{},
"scripts"
:
{},
"bin"
:
{},
"bin"
:
{},
...
...
spec/associations.spec.js
View file @
87dbb14
...
@@ -21,7 +21,20 @@ describe('Associations', function() {
...
@@ -21,7 +21,20 @@ describe('Associations', function() {
expect
(
sequelize
.
modelManager
.
getModel
(
'wp_table1swp_table2s'
)).
toBeDefined
()
expect
(
sequelize
.
modelManager
.
getModel
(
'wp_table1swp_table2s'
)).
toBeDefined
()
})
})
})
})
// TODO add test for specifying join table name
describe
(
'when join table name is specified'
,
function
()
{
var
Table2
=
sequelize
.
define
(
'ms_table1'
,
{
foo
:
Sequelize
.
STRING
})
,
Table1
=
sequelize
.
define
(
'ms_table2'
,
{
foo
:
Sequelize
.
STRING
})
Table1
.
hasMany
(
Table2
,
{
joinTableName
:
'table1_to_table2'
})
Table2
.
hasMany
(
Table1
,
{
joinTableName
:
'table1_to_table2'
})
it
(
"should not use a combined name"
,
function
()
{
expect
(
sequelize
.
modelManager
.
getModel
(
'ms_table1sms_table2s'
)).
toBeUndefined
()
})
it
(
"should use the specified name"
,
function
()
{
expect
(
sequelize
.
modelManager
.
getModel
(
'table1_to_table2'
)).
toBeDefined
()
})
})
})
})
})
})
spec/config/config.js
View file @
87dbb14
module
.
exports
=
{
module
.
exports
=
{
username
:
"
root
"
,
username
:
"
meg
"
,
password
:
null
,
password
:
"meg"
,
database
:
'
sequelize_
test'
,
database
:
'test'
,
host
:
'127.0.0.1'
,
host
:
'127.0.0.1'
,
rand
:
function
()
{
rand
:
function
()
{
return
parseInt
(
Math
.
random
()
*
999
)
return
parseInt
(
Math
.
random
()
*
999
)
...
...
test/config.js
View file @
87dbb14
module
.
exports
=
{
module
.
exports
=
{
username
:
"
root
"
,
username
:
"
meg
"
,
password
:
null
,
password
:
"meg"
,
database
:
'
sequelize_
test'
,
database
:
'test'
,
host
:
'127.0.0.1'
,
host
:
'127.0.0.1'
,
rand
:
function
()
{
rand
:
function
()
{
return
parseInt
(
Math
.
random
()
*
999
)
return
parseInt
(
Math
.
random
()
*
999
)
...
...
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