不要怂,就是干,撸起袖子干!

Commit 87dbb148 by Meg Sharkey

added test

1 parent d8cfd984
{ {
"name": "sequelize", "name": "sqlize",
"description": "MySQL ORM for Node.JS", "description": "Modified version of sequelize - MySQL 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": {},
......
...@@ -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()
})
})
}) })
}) })
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)
......
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)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!