-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}); | ||
}); |