core-resource-app-test
Version:
App that contains assets and scripts for the core apps
54 lines (44 loc) • 1.86 kB
text/coffeescript
describe 'leafletHelpers', ->
beforeEach ->
module('leaflet-directive')
inject (_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_) ->
@$compile = _$compile_
@$rootScope = _$rootScope_
= _leafletData_
= _leafletHelpers_
describe 'isTruthy', ->
beforeEach ->
= .isTruthy
describe 'is true', ->
it "'true'", ->
expect().toBeTruthy()
it "true", ->
expect().toBeTruthy()
describe 'is false', ->
it "'false'", ->
expect().toBeFalsy()
it "false", ->
expect().toBeFalsy()
it "undefined", ->
expect().toBeFalsy()
describe 'defaultTo', ->
beforeEach ->
= .defaultTo
it 'keeps value', ->
it 'false', ->
expect().toBeTruthy()
it 'string', ->
expect().toBe('hi')
it '{}', ->
expect().toBe({})
describe 'gets default', ->
it 'undefined', ->
expect().toBe('')
it 'null', ->
expect().toBe('')
describe 'Object Helpers', ->
it 'should correctly fetch object values using dot-notation', ->
object = { foo: { sea: 'hawks' }}
expect(.getObjectValue(object, 'foo.sea')).toEqual('hawks')
expect(.getObjectValue(object, 'foo.sea.birds')).toEqual(undefined)
expect(.getObjectValue(object, 'boo.hoo')).toEqual(undefined)