Skip to content

Commit

Permalink
codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-kot committed Sep 10, 2024
1 parent 51884bd commit f4d7588
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
18 changes: 12 additions & 6 deletions src/alert/__tests__/runtime-content.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ describe('asynchronous rendering', () => {
runReplacer(context, replacer) {
(async () => {
await pause(500);
replacer.hideHeader();
replacer.restoreHeader();
replacer.replaceHeader(headerFn);
replacer.hideContent();
replacer.restoreContent();
replacer.replaceContent(contentFn);
})();
return {
Expand All @@ -244,12 +248,14 @@ describe('asynchronous rendering', () => {
unmount();

await waitFor(() => {
expect(consoleWarnSpy).toBeCalledWith(
'[AwsUi] [Runtime alert content] `replaceHeader` called after component unmounted'
);
expect(consoleWarnSpy).toBeCalledWith(
'[AwsUi] [Runtime alert content] `replaceContent` called after component unmounted'
);
const message = (method: string) =>
`[AwsUi] [Runtime alert content] \`${method}\` called after component unmounted`;
expect(consoleWarnSpy).toBeCalledWith(message('hideHeader'));
expect(consoleWarnSpy).toBeCalledWith(message('restoreHeader'));
expect(consoleWarnSpy).toBeCalledWith(message('replaceHeader'));
expect(consoleWarnSpy).toBeCalledWith(message('hideContent'));
expect(consoleWarnSpy).toBeCalledWith(message('restoreContent'));
expect(consoleWarnSpy).toBeCalledWith(message('replaceContent'));
expect(headerFn).not.toBeCalled();
expect(contentFn).not.toBeCalled();
});
Expand Down
18 changes: 12 additions & 6 deletions src/flashbar/__tests__/runtime-content.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@ describe('asynchronous rendering', () => {
runReplacer(context, replacer) {
(async () => {
await pause(500);
replacer.hideHeader();
replacer.restoreHeader();
replacer.replaceHeader(headerFn);
replacer.hideContent();
replacer.restoreContent();
replacer.replaceContent(contentFn);
})();
return {
Expand All @@ -242,12 +246,14 @@ describe('asynchronous rendering', () => {
unmount();

await waitFor(() => {
expect(consoleWarnSpy).toBeCalledWith(
'[AwsUi] [Runtime flash content] `replaceHeader` called after component unmounted'
);
expect(consoleWarnSpy).toBeCalledWith(
'[AwsUi] [Runtime flash content] `replaceContent` called after component unmounted'
);
const message = (method: string) =>
`[AwsUi] [Runtime flash content] \`${method}\` called after component unmounted`;
expect(consoleWarnSpy).toBeCalledWith(message('hideHeader'));
expect(consoleWarnSpy).toBeCalledWith(message('restoreHeader'));
expect(consoleWarnSpy).toBeCalledWith(message('replaceHeader'));
expect(consoleWarnSpy).toBeCalledWith(message('hideContent'));
expect(consoleWarnSpy).toBeCalledWith(message('restoreContent'));
expect(consoleWarnSpy).toBeCalledWith(message('replaceContent'));
expect(headerFn).not.toBeCalled();
expect(contentFn).not.toBeCalled();
});
Expand Down

0 comments on commit f4d7588

Please sign in to comment.