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

Commit d407fdfc by sdepold

moved utils specs

1 parent 01f3180c
Showing with 30 additions and 19 deletions
......@@ -36,4 +36,34 @@ describe('Utils', function() {
expect(result).toMatch(/.*alert\(2\).*/)
})
})
describe('underscore', function() {
describe('underscoredIf', function() {
it('is defined', function() {
expect(Utils._.underscoredIf).toBeDefined()
})
it('underscores if second param is true', function() {
expect(Utils._.underscoredIf('fooBar', true)).toEqual('foo_bar')
})
it("doesn't underscore if second param is false", function() {
expect(Utils._.underscoredIf('fooBar', false)).toEqual('fooBar')
})
})
describe('camelizeIf', function() {
it('is defined', function() {
expect(Utils._.camelizeIf).toBeDefined()
})
it('camelizes if second param is true', function() {
expect(Utils._.camelizeIf('foo_bar', true)).toEqual('fooBar')
})
it("doesn't camelize if second param is false", function() {
expect(Utils._.underscoredIf('fooBar', true)).toEqual('foo_bar')
})
})
})
})
var assert = require("assert")
, Utils = require("../../lib/utils")
module.exports = {
'underscoredIf should be defined': function() {
assert.isDefined(Utils._.underscoredIf)
},
'underscoredIf should work correctly': function() {
assert.eql(Utils._.underscoredIf('fooBar', false), 'fooBar')
assert.eql(Utils._.underscoredIf('fooBar', true), 'foo_bar')
},
'camelizeIf should be defined': function() {
assert.isDefined(Utils._.camelizeIf)
},
'camelizeIf should work correctly': function() {
assert.eql(Utils._.camelizeIf('foo_bar', false), 'foo_bar')
assert.eql(Utils._.camelizeIf('foo_bar', true), 'fooBar')
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!