Skip to content

Commit

Permalink
fix(workspace): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherPHolder committed Aug 26, 2024
1 parent c26f496 commit fe2fa33
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions e2e/cli-e2e/tests/collect/format.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit fe2fa33

Please sign in to comment.