-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.js
36 lines (29 loc) · 1.13 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
describe('sessionStorage', function () {
'use strict';
var assume = require('assume')
, sessionStorage = require('./');
it('is exported as object', function () {
assume(sessionStorage).is.a('object');
});
it('as the API methods', function () {
assume(sessionStorage.getItem).is.a('function');
assume(sessionStorage.setItem).is.a('function');
assume(sessionStorage.removeItem).is.a('function');
assume(sessionStorage.clear).is.a('function');
assume(sessionStorage.length).is.a('number');
});
it('works as intended', function () {
sessionStorage.setItem('foo', 'bar');
assume(sessionStorage.length).equals(1);
assume(sessionStorage.getItem('foo')).equals('bar');
sessionStorage.setItem('hello', 'world');
assume(sessionStorage.length).equals(2);
assume(sessionStorage.getItem('hello')).equals('world');
sessionStorage.removeItem('hello');
assume(sessionStorage.length).equals(1);
assume(sessionStorage.getItem('hello')).is.a('null');
assume(sessionStorage.getItem('foo')).equals('bar');
sessionStorage.clear();
assume(sessionStorage.length).equals(0);
});
});