Skip to content

Commit

Permalink
test: IlcAppSdk
Browse files Browse the repository at this point in the history
  • Loading branch information
nightnei committed Dec 17, 2021
1 parent 5234643 commit 588c5c4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/app/IlcAppSdk.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import IlcAppSdk from '../../src/app/index';
import { expect } from 'chai';

describe('IlcAppSdk', () => {
it('should throw error due to not provided adapter', () => {
// @ts-ignore
expect(() => new IlcAppSdk()).to.throw('Unable to determine adapter properly...');
});

it('should render404 run trigger404Page method from adapter', () => {
let page404Rendered = false;

const appSdk = new IlcAppSdk({
appId: 'someAppId',
intl: null,
trigger404Page: () => {
page404Rendered = true;
},
});

expect(page404Rendered).to.be.false;
appSdk.render404();
expect(page404Rendered).to.be.true;
});

it('should "unmount" throw error due to not defined set method in adapter', () => {
const appSdk = new IlcAppSdk({
appId: 'someAppId',
intl: null,
trigger404Page: () => {},
});

expect(() => appSdk.unmount()).to.throw("Looks like you're trying to call CSR only method during SSR");
});
});

0 comments on commit 588c5c4

Please sign in to comment.