test(ct): solid hooks (#16864)

This commit is contained in:
sand4rt 2022-08-27 00:48:41 +02:00 committed by GitHub
parent 996468d4b7
commit 849da28dc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,17 @@ test('default child should work', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})
test('should run hooks', async ({ page, mount }) => {
const messages: string[] = [];
page.on('console', m => messages.push(m.text()));
await mount(<Button title="Submit" />, {
hooksConfig: {
route: 'A'
}
});
expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
});
test('should unmount', async ({ page, mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(page.locator('#root')).toContainText('Submit')