1 | const Plugin = require('./Plugin')
|
2 | const Core = require('./index')
|
3 |
|
4 | describe('Plugin', () => {
|
5 | describe('getPluginState', () => {
|
6 | it('returns an empty object if no state is available', () => {
|
7 | class Example extends Plugin {}
|
8 | const inst = new Example(new Core(), {})
|
9 |
|
10 | expect(inst.getPluginState()).toEqual({})
|
11 | })
|
12 | })
|
13 |
|
14 | describe('setPluginState', () => {
|
15 | it('applies patches', () => {
|
16 | class Example extends Plugin {}
|
17 | const inst = new Example(new Core(), {})
|
18 |
|
19 | inst.setPluginState({ a: 1 })
|
20 | expect(inst.getPluginState()).toEqual({ a: 1 })
|
21 | inst.setPluginState({ b: 2 })
|
22 | expect(inst.getPluginState()).toEqual({ a: 1, b: 2 })
|
23 | })
|
24 | })
|
25 | })
|