From fe2fa337fdfb547eb7fb951808976ccad30466e9 Mon Sep 17 00:00:00 2001 From: ChristopherPHolder Date: Mon, 26 Aug 2024 18:14:33 +0200 Subject: [PATCH] fix(workspace): fix test --- e2e/cli-e2e/tests/collect/format.e2e.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e2e/cli-e2e/tests/collect/format.e2e.test.ts b/e2e/cli-e2e/tests/collect/format.e2e.test.ts index db0a1be0..ebc5d76e 100644 --- a/e2e/cli-e2e/tests/collect/format.e2e.test.ts +++ b/e2e/cli-e2e/tests/collect/format.e2e.test.ts @@ -5,6 +5,7 @@ import { join } from 'node:path'; import { CliTest, DEFAULT_RC, USER_FLOW_MOCKS } from '../../utils/setup'; const DUMMY_USER_FLOW_NAME = 'Basic Navigation Example'; +const MOCK_MD_REPORT_HEADER = '| Gather Mode | Performance | Accessibility | Best Practices | Seo |'; describe('collect format', () => { ['html', 'json', 'md'].forEach((format) => { @@ -33,7 +34,7 @@ describe('collect format', () => { const { code, stdout, stderr } = await cli.run('user-flow', ['collect']); - expect(stdout).toContain(`| Gather Mode | Performance | Accessibility | Best Practices | Seo |`) + expect(stdout).toContain(MOCK_MD_REPORT_HEADER) expect(stdout).toContain(DUMMY_USER_FLOW_NAME); expect(stderr).toBe(''); expect(code).toBe(0); @@ -54,7 +55,7 @@ describe('collect format', () => { expect(isValidFormatedResult(format, content)).toBeTruthy(); }); - expect(stdout).toContain(`| Gather Mode | Performance | Accessibility | Best Practices | Seo | Pwa |`) + expect(stdout).toContain(MOCK_MD_REPORT_HEADER) expect(stdout).toContain(DUMMY_USER_FLOW_NAME); expect(stderr).toBe(''); expect(code).toBe(0); @@ -66,7 +67,7 @@ function isValidFormatedResult(format: string, result: string) { const isValidFile = { 'html': (report: string) => report.includes(DUMMY_USER_FLOW_NAME), 'json': (report: string) => !!(JSON.parse(report)?.name || '').includes(DUMMY_USER_FLOW_NAME), - 'md': (report: string) => report.includes(`| Gather Mode | Performance | Accessibility | Best Practices | Seo |`) + 'md': (report: string) => report.includes(MOCK_MD_REPORT_HEADER) }; // @ts-ignore return isValidFile[format](result);