Skip to content

Commit

Permalink
Fix compression tests for legacy IE; make compression tests test for …
Browse files Browse the repository at this point in the history
…size rather than exact value stored
  • Loading branch information
marcuswestin committed Jun 20, 2017
1 parent 5b6a777 commit ec6904c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/compression_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ module.exports = {
}

function setup(store) {
test('string compression', function() {
store.set('foo', 'baz')
assert(store.raw.get('foo') == 'ᄂゆ׬䀀', 'string should be lz compressed')
assert(store.get('foo') == 'baz', 'value should be baz')
test('string compression size', function() {
var str = 'foo'
var serialized = store._serialize(str)
store.set('foo', str)
assert(store.raw.get('foo').length < serialized.length, 'compressed string should be smaller than uncompressed')
assert(deepEqual(store.get('foo'), str), 'value should be equal')
})

test('object compression', function () {
var obj = { one: { two: 3 }}
var serialized = store._serialize(obj)
store.set('foo', obj)
assert(store.raw.get('foo') == '㞂⃶ݠ꘠岠ᜃ릎٠⾆耀', 'object should be lz compressed')
assert(store.raw.get('foo').length < serialized.length, 'compressed object should be smaller than uncompressed')
assert(deepEqual(store.get('foo'), obj), 'should deep equal original object')
store.remove('foo')
})
Expand Down

0 comments on commit ec6904c

Please sign in to comment.