[TNL-7268] Fix tests and dependencies after rebase

This commit is contained in:
Agrendalath
2020-06-29 04:21:23 +02:00
committed by David Joy
parent 8719fad091
commit 6f7ec81197
5 changed files with 9 additions and 15 deletions

View File

@@ -72,9 +72,11 @@ describe('Unit', () => {
window.postMessage(testMessageWithUnhandledType, '*');
// HACK: We don't have a function we could reliably await here, so this test relies on the timeout of `waitFor`.
// FIXME: After the last updates `toThrowErrorMatchingSnapshot` (due to a bug) started returning DOM
// after the error, so we had to fall back to `toThrowError` assertion for better readability.
await expect(waitFor(
() => expect(screen.getByTitle(mockData.id)).toHaveAttribute('height', String(testMessageWithUnhandledType.payload.height)),
{ timeout: 100 },
)).rejects.toThrowErrorMatchingSnapshot();
)).rejects.toThrowError(/Expected the element to have attribute/);
});
});

View File

@@ -42,15 +42,6 @@ exports[`Unit handles receiving MessageEvent 1`] = `
title=\\"3\\""
`;
exports[`Unit ignores MessageEvent with unhandled type 1`] = `
"expect(element).toHaveAttribute(\\"height\\", \\"300\\") // element.getAttribute(\\"height\\") === \\"300\\"
Expected the element to have attribute:
 height=\\"300\\"
Received:
 height=\\"0\\""
`;
exports[`Unit renders correctly 1`] = `
<DocumentFragment>
<div

View File

@@ -4,7 +4,7 @@ import UnitIcon from './UnitIcon';
describe('Unit Icon', () => {
const types = {
video: 'fa-film',
video: 'fa-video',
other: 'fa-book',
vertical: 'fa-tasks',
problem: 'fa-edit',
@@ -20,7 +20,7 @@ describe('Unit Icon', () => {
}
const { asFragment } = render(<UnitIcon type={key} />);
expect(screen.getByAltText(value)).toBeInTheDocument();
expect(screen.getByTestId('icon')).toHaveClass(value);
expect(asFragment()).toMatchSnapshot();
});
});

View File

@@ -53,8 +53,8 @@ exports[`Unit Icon renders correct icon for vertical unit 1`] = `
exports[`Unit Icon renders correct icon for video unit 1`] = `
<DocumentFragment>
<img
alt="fa-film"
class="fa-film"
alt="fa-video"
class="fa-video"
data-testid="icon"
/>
</DocumentFragment>