Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix "not an array" error check in tests

  • Loading branch information...
commit 8c5416ebfd6351a9e457a58cac373b81d12847d7 1 parent 8e627e5
@nateps nateps authored
Showing with 12 additions and 12 deletions.
  1. +7 −7 test/Memory.mocha.coffee
  2. +5 −5 test/dbAdapter/storeMutators.coffee
View
14 test/Memory.mocha.coffee
@@ -109,7 +109,7 @@ describe 'Memory', ->
try
memory.pop 'nonArray', ver, null
catch e
- expect(e.message).to.contain 'not an Array'
+ expect(e.message.toLowerCase()).to.contain 'not an array'
didThrowNotAnArray = true
expect(didThrowNotAnArray).to.be.true
@@ -121,7 +121,7 @@ describe 'Memory', ->
try
memory.push 'nonArray', 5, 6, ver, null
catch e
- expect(e.message).to.contain 'not an Array'
+ expect(e.message.toLowerCase()).to.contain 'not an array'
didThrowNotAnArray = true
expect(didThrowNotAnArray).to.be.true
@@ -163,7 +163,7 @@ describe 'Memory', ->
try
memory.shift 'nonArray', ver, null
catch e
- expect(e.message).to.contain 'not an Array'
+ expect(e.message.toLowerCase()).to.contain 'not an array'
didThrowNotAnArray = true
expect(didThrowNotAnArray).to.be.true
@@ -175,7 +175,7 @@ describe 'Memory', ->
try
memory.unshift 'nonArray', 5, 6, ver, null
catch e
- expect(e.message).to.contain 'not an Array'
+ expect(e.message.toLowerCase()).to.contain 'not an array'
didThrowNotAnArray = true
expect(didThrowNotAnArray).to.be.true
@@ -222,7 +222,7 @@ describe 'Memory', ->
try
memory.insert 'nonArray', 0, 'never added', ver, null
catch e
- expect(e.message).to.contain 'not an Array'
+ expect(e.message.toLowerCase()).to.contain 'not an array'
didThrowNotAnArray = true
expect(didThrowNotAnArray).to.be.true
@@ -297,7 +297,7 @@ describe 'Memory', ->
try
memory.move 'nonArray', 0, 0, 1, ver, null
catch e
- expect(e.message).to.contain 'not an Array'
+ expect(e.message.toLowerCase()).to.contain 'not an array'
didThrowNotAnArray = true
expect(didThrowNotAnArray).to.be.true
@@ -312,7 +312,7 @@ describe 'Memory', ->
try
memory.remove 'nonArray', 0, 3, ver, null
catch e
- expect(e.message).to.contain 'not an Array'
+ expect(e.message.toLowerCase()).to.contain 'not an array'
didThrowNotAnArray = true
expect(didThrowNotAnArray).to.be.true
View
10 test/dbAdapter/storeMutators.coffee
@@ -148,7 +148,7 @@ module.exports = (storeOpts = {}, plugins = []) ->
expect(err).to.be.null()
store.pop 'globals._.nonArray', ++_ver, (err) ->
expect(err).to.not.be.null
- expect(err.message).to.contain 'not an Array'
+ expect(err.message.toLowerCase()).to.contain 'not an array'
done()
it 'push on a non array should result in a "Not an Array" error', (done) ->
@@ -158,7 +158,7 @@ module.exports = (storeOpts = {}, plugins = []) ->
expect(err).to.be.null()
store.push 'globals._.nonArray', [5, 6], ++_ver, (err) ->
expect(err).to.not.be.null
- expect(err.message).to.contain 'not an Array'
+ expect(err.message.toLowerCase()).to.contain 'not an array'
done()
it 'should be able to unshift a single value onto an undefined path', (done) ->
@@ -215,7 +215,7 @@ module.exports = (storeOpts = {}, plugins = []) ->
expect(err).to.be.null()
store.shift 'globals._.nonArray', ++_ver, (err, value, ver) ->
expect(err).to.not.be.null
- expect(err.message).to.contain 'not an Array'
+ expect(err.message.toLowerCase()).to.contain 'not an array'
done()
it 'unshift on a non array should result in a "Not an Array" error', (done) ->
@@ -225,7 +225,7 @@ module.exports = (storeOpts = {}, plugins = []) ->
expect(err).to.be.null()
store.unshift 'globals._.nonArray', [5, 6], ++_ver, (err, value, ver) ->
expect(err).to.not.be.null
- expect(err.message).to.contain 'not an Array'
+ expect(err.message.toLowerCase()).to.contain 'not an array'
done()
it 'insert 0 on an undefined path should result in a new array', (done) ->
@@ -298,7 +298,7 @@ module.exports = (storeOpts = {}, plugins = []) ->
expect(err).to.be.null()
store.insert 'globals._.nonArray', 0, ['never added'], ++_ver, (err) ->
expect(err).to.not.be.null
- expect(err.message).to.contain 'not an Array'
+ expect(err.message.toLowerCase()).to.contain 'not an array'
done()
it 'moving from index A to index B should work', (done) ->

0 comments on commit 8c5416e

Please sign in to comment.
Something went wrong with that request. Please try again.