Skip to content

Commit

Permalink
improve assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Schreck committed Feb 5, 2014
1 parent c44124a commit ac6f4c5
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions test/shared/store/memory_store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ describe('MemoryStore', function() {

it("should undefined for missing keys", function() {
var value = store.get('foobar');
should.equal(value, void 0);
should.not.exist(value);
});

it("should set and get a key + value", function() {
var value;

store.set('cached_value', 42);
value = store.get('cached_value');
should.equal(value, 42);
store.get('cached_value').should.equal(42);

store.set('cached_value', 'new value');
value = store.get('cached_value');
should.equal(value, 'new value');
store.get('cached_value').should.equal('new value');
});

it("should be able to clear a key", function() {
Expand All @@ -32,19 +28,19 @@ describe('MemoryStore', function() {
store.clear('somethin');
value = store.get('somethin');

should.equal(value, void 0);
should.not.exist(value);
});

it("should be able to expire a key", function(done) {
var value;

store.set('will_expire', '1234', 0.01);
value = store.get('will_expire');
should.equal(value, '1234');
value.should.equal('1234');

setTimeout(function() {
value = store.get('will_expire');
should.equal(value, void 0);
should.not.exist(value);
done();
}, 11);
});
Expand Down

0 comments on commit ac6f4c5

Please sign in to comment.