diff --git a/js-miniapp-sdk/test/miniapp.spec.ts b/js-miniapp-sdk/test/miniapp.spec.ts new file mode 100644 index 000000000..4c007ea4b --- /dev/null +++ b/js-miniapp-sdk/test/miniapp.spec.ts @@ -0,0 +1,27 @@ +/* tslint:disable:no-any */ + +import { expect } from 'chai'; +import sinon from 'sinon'; + +import MiniApp from '../src/miniapp'; + +const window: any = {}; +(global as any).window = window; + +describe('getUniqueId', () => { + before(() => { + window.MiniAppBridge = { + getUniqueId: sinon.stub(), + }; + }); + + it('should retrieve the unique id from the Mini App Bridge', () => { + window.MiniAppBridge.getUniqueId.resolves('test_mini_app_id'); + + const miniApp = new MiniApp(); + + return expect(miniApp.getUniqueId()).to.eventually.equal( + 'test_mini_app_id' + ); + }); +});