-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathuseAvatarForBot.js
More file actions
32 lines (25 loc) · 919 Bytes
/
useAvatarForBot.js
File metadata and controls
32 lines (25 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { timeouts } from '../constants.json';
// selenium-webdriver API doc:
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html
jest.setTimeout(timeouts.test);
test('getter should return image and initial of avatar for bot', async () => {
const { pageObjects } = await setupWebDriver({
props: {
styleOptions: {
botAvatarImage: 'about:blank#bot-icon',
botAvatarInitials: 'WC'
}
}
});
const [{ image, initials }] = await pageObjects.runHook('useAvatarForBot');
expect({ image, initials }).toMatchInlineSnapshot(`
{
"image": "about:blank#bot-icon",
"initials": "WC",
}
`);
});
test('setter should throw exception', async () => {
const { pageObjects } = await setupWebDriver();
await expect(pageObjects.runHook('useAvatarForBot', [], result => result[1]())).rejects.toThrow();
});