12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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
|