Example #1
0
 it("handles nested objects correctly", function(done) {
   expect(hstore.stringifyPart({ test: { nested: 'value' } })).to.equal('"{\\"test\\":{\\"nested\\":\\"value\\"}}"')
   done()
 })
Example #2
0
 it("handles objects correctly", function(done) {
   expect(hstore.stringifyPart({test: {nested: {value: {including: '"string"'}}}})).to.equal('"{\\"test\\":{\\"nested\\":{\\"value\\":{\\"including\\":\\"\\\\\\"string\\\\\\"\\"}}}}"')
   done()
 })
Example #3
0
 it("handles arrays correctly", function(done) {
   expect(hstore.stringifyPart([1,['2'],'"3"'])).to.equal('"[1,[\\"2\\"],\\"\\\\\\"3\\\\\\"\\"]"')
   done()
 })
Example #4
0
 it("handles simple objects correctly", function(done) {
   expect(hstore.stringifyPart({ test: 'value' })).to.equal('"{\\"test\\":\\"value\\"}"')
   done()
 })
Example #5
0
 it("handles strings with backslashes correctly", function(done) {
   expect(hstore.stringifyPart("\\'literally\\'")).to.equal('"\\\\\'literally\\\\\'"')
   done()
 })
Example #6
0
 it("handles strings correctly", function(done) {
   expect(hstore.stringifyPart('foo')).to.equal('"foo"')
   done()
 })
Example #7
0
 it("handles boolean values correctly", function(done) {
   expect(hstore.stringifyPart(false)).to.equal('false')
   expect(hstore.stringifyPart(true)).to.equal('true')
   done()
 })
Example #8
0
 it("handles null values correctly", function(done) {
   expect(hstore.stringifyPart(null)).to.equal('NULL')
   done()
 })
Example #9
0
 it("handles undefined values correctly", function(done) {
   expect(hstore.stringifyPart(undefined)).to.equal('NULL')
   done()
 })