Skip to content

Commit

Permalink
Serialization test for browser or Node.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
flatheadmill authored and ralphtheninja committed Sep 4, 2017
1 parent c3b90c2 commit 9af2369
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test.js
Expand Up @@ -75,13 +75,17 @@ test('test key/value serialization', function (t) {
t.equal(test._serializeKey(1), '1', '_serializeKey converts to string')
t.ok(test._serializeKey(buffer) === buffer, '_serializeKey returns Buffer as is')

var browser = !! process.browser
process.browser = false

t.equal(test._serializeValue(1), '1', '_serializeValue converts to string')
t.equal(test._serializeValue(null), '', '_serializeValue converts null to empty string')
t.ok(test._serializeValue(buffer) === buffer, '_serializeValue returns Buffer as is')

process.browser = true
t.equal(test._serializeValue(1), 1, '_serializeValue returns value as is when process.browser')
delete process.browser

process.browser = process.browser

t.end()
})
Expand Down

0 comments on commit 9af2369

Please sign in to comment.