orionsoft-react-scripts
Version:
Orionsoft Configuration and scripts for Create React App.
73 lines (41 loc) • 1.14 kB
text/coffeescript
require './_prepare'
objectToSaneObject = mod 'objectToSaneObject'
describe "sanitize()"
test "case: 'text'", ->
input = 'text'
expectation = ['text']
ret = objectToSaneObject.sanitize input
ret.should.be.like expectation
test "case: ['text']", ->
input = ['text']
expectation = ['text']
ret = objectToSaneObject.sanitize input
ret.should.be.like expectation
test "case: {a:b}", ->
input = a: 'b'
expectation = [{a: ['b']}]
ret = objectToSaneObject.sanitize input
ret.should.be.like expectation
test "case: {a:[b: 'c']}", ->
input = a: [b: 'c']
expectation = [{a: [{b: ['c']}]}]
ret = objectToSaneObject.sanitize input
ret.should.be.like expectation
test "case: {a:b: 'c'}", ->
input = a: b: 'c'
expectation = [{
a: [{
b: ['c']
}]
}]
ret = objectToSaneObject.sanitize input
ret.should.be.like expectation
test "case: {a:b: ['c', d: 'e']}", ->
input = a: b: ['c', d: 'e']
expectation = [{
a: [{
b: ['c', {d: ['e']}]
}]
}]
ret = objectToSaneObject.sanitize input
ret.should.be.like expectation