UNPKG

websdk-test

Version:

efox-websdk适用不同版本工具调用api组件

33 lines (28 loc) 761 B
import EfoxWebSdk from '../src' describe('init', async () => { const sdk = new EfoxWebSdk( { win: { getVersion: (a, b) => { console.log('a', a, b); return Promise.resolve(1) } } }, 'isCef' ) const WebSDK = sdk.get test('init', async () => { WebSDK('win.getVersion').then(res => { console.log('getVersion', res) }) expect(WebSDK('win.getVersion', 'obj', 'abc')).resolves.toBe(1); await WebSDK('win1.getVersion') await WebSDK('win1.getVersion.catch').catch(e => {}) WebSDK('win1.getVersion').then(res => { console.log('ers', res) }).catch(error => { console.log('catch sdk exception: ', error) }) }) })