数通智联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
763 B

import { describe, expect, it } from '@jest/globals'
import UIPlugin from './UIPlugin.js'
import Core from './index.js'
describe('UIPlugin', () => {
describe('getPluginState', () => {
it('returns an empty object if no state is available', () => {
class Example extends UIPlugin {}
const inst = new Example(new Core(), {})
expect(inst.getPluginState()).toEqual({})
})
})
describe('setPluginState', () => {
it('applies patches', () => {
class Example extends UIPlugin {}
const inst = new Example(new Core(), {})
inst.setPluginState({ a: 1 })
expect(inst.getPluginState()).toEqual({ a: 1 })
inst.setPluginState({ b: 2 })
expect(inst.getPluginState()).toEqual({ a: 1, b: 2 })
})
})
})