Skip to content

Commit

Permalink
added defaultnormalising before text match on testing
Browse files Browse the repository at this point in the history
  • Loading branch information
AAloshine-scottlogic committed Mar 1, 2024
1 parent f414411 commit f7d5770
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { render, screen, fireEvent } from '@testing-library/react';
import {
render,
screen,
fireEvent,
getDefaultNormalizer,
} from '@testing-library/react';
import { describe, expect, test, vi } from 'vitest';

import { LEVELS } from '@src/Levels';
Expand All @@ -21,10 +26,10 @@ describe('LevelMissionInfoBanner component tests', () => {
if (!expectedContent)
throw new Error(`No missionInfoShort found for level ${currentLevel}`);

const expectedText = expectedContent
.slice(0, expectedContent.indexOf(' <u>'))
.replace(/\s+/g, ' '); //normalising whitespace

const expectedText = getDefaultNormalizer()(
expectedContent.slice(0, expectedContent.indexOf(' <u>'))
);
console.log(expectedText);
const banner = screen.getByText(expectedText);
expect(banner).toContainHTML(expectedContent);
});
Expand Down

0 comments on commit f7d5770

Please sign in to comment.