GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 52edd8...986108 )
by Cedric
01:27
created

test/model/store.spec.js   A

Complexity

Total Complexity 22
Complexity/F 1

Size

Lines of Code 134
Function Count 22

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 0
wmc 22
c 3
b 0
f 0
nc 1
mnd 0
bc 22
fnc 22
dl 0
loc 134
rs 10
bpm 1
cpm 1
noi 0
1
import {expect} from 'chai';
2
import Store from '../../src/model/store';
3
4
describe('Store.constructor', () => {
5
    it('should return an instance of Store', () => {
6
        let store = new Store();
7
        expect(store).to.be.instanceOf(Store);
8
    });
9
10
    it('should populate the store with the given object', () => {
11
        let store = new Store({
12
            foo: 'bar',
13
            baz: 42
14
        });
15
16
        expect(store._store).to.have.property('foo', 'bar');
17
        expect(store._store).to.have.property('baz', 42);
18
    });
19
});
20
21
describe('Store.reset', () => {
22
    let store;
23
    beforeEach(() => {
24
        store = new Store();
25
    });
26
27
    it('should empty the store', () => {
28
        store._store = {
29
            'foo': 'bar'
30
        };
31
        store.reset();
32
        expect(store._store).not.to.have.property('foo');
33
    });
34
});
35
36
describe('Store.set', () => {
37
    let store;
38
    beforeEach(() => {
39
        store = new Store();
40
    });
41
42
    it('should be able to set a key/value', () => {
43
        store.set('foo', 'bar');
44
        expect(store._store).to.have.property('foo', 'bar');
45
    });
46
47
    it('should be able to set a multi level key', () => {
48
        store.set('foo.bar', 42);
49
        expect(store._store).to.have.property('foo');
50
        expect(store._store.foo).to.have.property('bar', 42);
51
    });
52
53
    it('should be able to set a multi level key', () => {
54
        store.set('foo.bar.deep', 42);
55
        expect(store._store).to.have.property('foo');
56
        expect(store._store.foo).to.have.property('bar');
57
        expect(store._store.foo.bar).to.have.property('deep', 42);
58
    });
59
60
    it('should be able to set multiple multi level key', () => {
61
        store.set('foo.bar.deep', 42);
62
        store.set('foo.baz.deep', 43);
63
        expect(store._store).to.have.property('foo');
64
        expect(store._store.foo).to.have.property('bar');
65
        expect(store._store.foo).to.have.property('baz');
66
        expect(store._store.foo.bar).to.have.property('deep', 42);
67
        expect(store._store.foo.baz).to.have.property('deep', 43);
68
    });
69
});
70
71
describe('Store.get', () => {
72
    let store;
73
    beforeEach(() => {
74
        store = new Store({
75
            'foo': {
76
                'bar': {
77
                    'baz': 42
78
                }
79
            },
80
            'foobar': 'raboof',
81
            'foobaz': 'zaboof'
82
        });
83
    });
84
85
86
    it('should be able to recover a value from the store', () => {
87
        expect(store.get('foobar')).to.equal('raboof');
88
    });
89
90
    it('should be able to read a multi level key from the store', () => {
91
        let value = store.get('foo.bar');
92
        expect(value).to.have.property('baz', 42);
93
    });
94
95
    it('should be able to read a multi level key from the store', () => {
96
        expect(store.get('foo.bar.baz')).to.equal(42);
97
    });
98
99
    it('should return the whole store if no key is given', () => {
100
        let value = store.get();
101
        expect(value).to.have.property('foobar', 'raboof');
102
        expect(value).to.have.property('foobaz', 'zaboof');
103
    });
104
105
    it('should return the default value if the key is undefined', () => {
106
        expect(store.get('unknown', 42)).to.equal(42);
107
    });
108
});
109
110
describe('Store.toJS', () => {
111
    let store;
112
    beforeEach(() => {
113
        store = new Store({
114
            'foo': {
115
                'bar': {
116
                    'baz': 42
117
                }
118
            },
119
            'foobar': 'raboof',
120
            'foobaz': 'zaboof'
121
        });
122
    });
123
124
   it('should return the store', () => {
125
       let value = store.toJS();
126
127
       expect(value).to.have.property('foo');
128
       expect(value.foo).to.have.property('bar');
129
       expect(value.foo.bar).to.have.property('baz', 42);
130
       expect(value).to.have.property('foobar', 'raboof');
131
       expect(value).to.have.property('foobaz', 'zaboof');
132
   });
133
134
});
135