1 |
|
2 |
|
3 |
|
4 |
|
5 | 'use strict'
|
6 |
|
7 | const Apemanstore = require('../lib/apemanstore.js')
|
8 | const assert = require('assert')
|
9 | const co = require('co')
|
10 |
|
11 | describe('apemanstore', function () {
|
12 | this.timeout(3000)
|
13 |
|
14 | before(() => co(function * () {
|
15 |
|
16 | }))
|
17 |
|
18 | after(() => co(function * () {
|
19 |
|
20 | }))
|
21 |
|
22 | it('Apemanstore', () => co(function * () {
|
23 | let store = new Apemanstore()
|
24 | assert.ok(store)
|
25 | store.set('spins', { rootSpinning: true })
|
26 | assert.deepEqual(store.get('spins'), { rootSpinning: true })
|
27 |
|
28 | let store2 = store.sub('entries').sub('products')
|
29 | store2.set('list', [ { name: 'Wonderful-Box' } ])
|
30 | store2.push('list', { name: 'Yellow-Window' })
|
31 | assert.deepEqual(store2.toJSON(), {
|
32 | list: [
|
33 | { name: 'Wonderful-Box' },
|
34 | { name: 'Yellow-Window' }
|
35 | ]
|
36 | })
|
37 |
|
38 | let store3 = store.sub('entries').sub('products').sub('meta')
|
39 | store3.set('hasMore', false)
|
40 | assert.deepEqual(store3.toJSON(), { hasMore: false })
|
41 | store3.flip('hasMore')
|
42 | assert.deepEqual(store3.toJSON(), { hasMore: true })
|
43 |
|
44 |
|
45 | }))
|
46 | })
|
47 |
|
48 |
|