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

Commit 2f32ec8d by sdepold

moved specs to jasmine

1 parent d407fdfc
...@@ -37,6 +37,24 @@ describe('Utils', function() { ...@@ -37,6 +37,24 @@ describe('Utils', function() {
}) })
}) })
describe('argsArePrimaryKeys', function() {
it("doesn't detect primary keys if primareyKeys and values have different lengths", function() {
expect(Utils.argsArePrimaryKeys([1,2,3], [1])).toBeFalsy()
})
it("doesn't detect primary keys if primary keys are hashes or arrays", function() {
expect(Utils.argsArePrimaryKeys([[]], [1])).toBeFalsy()
})
it('detects primary keys if length is correct and data types are matching', function() {
expect(Utils.argsArePrimaryKeys([1,2,3], ["INT", "INT", "INT"])).toBeTruthy()
})
it("detects primary keys if primary keys are dates and lengths are matching", function() {
expect(Utils.argsArePrimaryKeys([new Date()], ['foo'])).toBeTruthy()
})
})
describe('underscore', function() { describe('underscore', function() {
describe('underscoredIf', function() { describe('underscoredIf', function() {
it('is defined', function() { it('is defined', function() {
......
var assert = require("assert")
, Utils = require("../../lib/utils")
module.exports = {
'it should be false if primaryKeys and args have different lengths': function() {
assert.eql(false, Utils.argsArePrimaryKeys([1,2,3], [1]))
},
'it should be false if primaryKeys are hashes or arrays': function() {
assert.eql(false, Utils.argsArePrimaryKeys([[]], [1]))
},
'it should be true if primaryKeys are primitive data types and lengths are matching': function() {
assert.eql(true, Utils.argsArePrimaryKeys([1,2,3], ["INT", "INT", "INT"]))
},
'it should be true if primaryKeys are dates and lengths are matching': function() {
assert.eql(true, Utils.argsArePrimaryKeys([new Date()], ['foo']))
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!