mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Reporting] Add lenience to a test on the order of asserted logs (#108135)
This commit is contained in:
parent
ee10819ef0
commit
a444d8a4ab
1 changed files with 14 additions and 15 deletions
|
@ -88,7 +88,7 @@ describe('POST /diagnose/browser', () => {
|
|||
await server.start();
|
||||
|
||||
mockedCreateInterface.mockImplementation(() => ({
|
||||
addEventListener: (e: string, cb: any) => setTimeout(() => cb(devtoolMessage), 0),
|
||||
addEventListener: (_e: string, cb: any) => setTimeout(() => cb(devtoolMessage), 0),
|
||||
removeEventListener: jest.fn(),
|
||||
removeAllListeners: jest.fn(),
|
||||
close: jest.fn(),
|
||||
|
@ -110,7 +110,7 @@ describe('POST /diagnose/browser', () => {
|
|||
await server.start();
|
||||
|
||||
mockedCreateInterface.mockImplementation(() => ({
|
||||
addEventListener: (e: string, cb: any) => setTimeout(() => cb(logs), 0),
|
||||
addEventListener: (_e: string, cb: any) => setTimeout(() => cb(logs), 0),
|
||||
removeEventListener: jest.fn(),
|
||||
removeAllListeners: jest.fn(),
|
||||
close: jest.fn(),
|
||||
|
@ -146,7 +146,7 @@ describe('POST /diagnose/browser', () => {
|
|||
await server.start();
|
||||
|
||||
mockedCreateInterface.mockImplementation(() => ({
|
||||
addEventListener: (e: string, cb: any) => {
|
||||
addEventListener: (_e: string, cb: any) => {
|
||||
setTimeout(() => cb(devtoolMessage), 0);
|
||||
setTimeout(() => cb(fontNotFoundMessage), 0);
|
||||
},
|
||||
|
@ -186,7 +186,7 @@ describe('POST /diagnose/browser', () => {
|
|||
await server.start();
|
||||
|
||||
mockedCreateInterface.mockImplementation(() => ({
|
||||
addEventListener: (e: string, cb: any) => {
|
||||
addEventListener: (_e: string, cb: any) => {
|
||||
setTimeout(() => cb(fontNotFoundMessage), 0);
|
||||
},
|
||||
removeEventListener: jest.fn(),
|
||||
|
@ -209,17 +209,16 @@ describe('POST /diagnose/browser', () => {
|
|||
.post('/api/reporting/diagnose/browser')
|
||||
.expect(200)
|
||||
.then(({ body }) => {
|
||||
expect(body).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"help": Array [
|
||||
"The browser couldn't locate a default font. Please see https://www.elastic.co/guide/en/kibana/current/reporting-troubleshooting.html#reporting-troubleshooting-system-dependencies to fix this issue.",
|
||||
],
|
||||
"logs": "Could not find the default font
|
||||
Browser exited abnormally during startup
|
||||
",
|
||||
"success": false,
|
||||
}
|
||||
const helpArray = [...body.help];
|
||||
helpArray.sort();
|
||||
expect(helpArray).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"The browser couldn't locate a default font. Please see https://www.elastic.co/guide/en/kibana/current/reporting-troubleshooting.html#reporting-troubleshooting-system-dependencies to fix this issue.",
|
||||
]
|
||||
`);
|
||||
expect(body.logs).toMatch(/Could not find the default font/);
|
||||
expect(body.logs).toMatch(/Browser exited abnormally during startup/);
|
||||
expect(body.success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -242,7 +241,7 @@ describe('POST /diagnose/browser', () => {
|
|||
}));
|
||||
|
||||
mockedCreateInterface.mockImplementation(() => ({
|
||||
addEventListener: (e: string, cb: any) => setTimeout(() => cb(devtoolMessage), 0),
|
||||
addEventListener: (_e: string, cb: any) => setTimeout(() => cb(devtoolMessage), 0),
|
||||
removeEventListener: jest.fn(),
|
||||
removeAllListeners: createInterfaceListenersMock,
|
||||
close: createInterfaceCloseMock,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue