richie-education 2.25.0-b2.dev136 → 2.25.0-b2.dev138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -123,7 +123,7 @@ describe('<DashboardCourses/>', () => {
|
|
|
123
123
|
enrollmentsDeferred.resolve({ results: [], next: null, previous: null, count: 0 });
|
|
124
124
|
|
|
125
125
|
await expectNoSpinner('Loading orders and enrollments...');
|
|
126
|
-
expectBannerInfo('You have no enrollments nor orders yet.');
|
|
126
|
+
await expectBannerInfo('You have no enrollments nor orders yet.');
|
|
127
127
|
expect(screen.queryByRole('button', { name: 'Load more' })).not.toBeInTheDocument();
|
|
128
128
|
});
|
|
129
129
|
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import { BannerType, getBannerTestId } from 'components/Banner';
|
|
3
3
|
|
|
4
|
-
export const expectBannerError =
|
|
4
|
+
export const expectBannerError = (message: string, rootElement: ParentNode = document) => {
|
|
5
5
|
return expectBanner(BannerType.ERROR, message, rootElement);
|
|
6
6
|
};
|
|
7
|
-
export const expectBannerInfo =
|
|
7
|
+
export const expectBannerInfo = (message: string, rootElement: ParentNode = document) => {
|
|
8
8
|
return expectBanner(BannerType.INFO, message, rootElement);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export const expectBanner =
|
|
11
|
+
export const expectBanner = (
|
|
12
12
|
type: BannerType,
|
|
13
13
|
message: string,
|
|
14
14
|
rootElement: ParentNode = document,
|
|
15
15
|
) => {
|
|
16
|
-
|
|
16
|
+
return waitFor(async () => {
|
|
17
17
|
const banner = rootElement.querySelector('.banner--' + type) as HTMLElement;
|
|
18
18
|
expect(banner).not.toBeNull();
|
|
19
19
|
expect(banner).toHaveTextContent(message);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export const expectNoBannerError =
|
|
23
|
+
export const expectNoBannerError = (message: string) => {
|
|
24
24
|
return expectNoBanner(BannerType.ERROR, message);
|
|
25
25
|
};
|
|
26
|
-
export const expectNoBannerInfo =
|
|
26
|
+
export const expectNoBannerInfo = (message: string) => {
|
|
27
27
|
return expectNoBanner(BannerType.INFO, message);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const expectNoBanner =
|
|
31
|
-
|
|
30
|
+
export const expectNoBanner = (type: BannerType, message: string) => {
|
|
31
|
+
return waitFor(() => {
|
|
32
32
|
expect(screen.queryByTestId(getBannerTestId(message, type))).toBeNull();
|
|
33
33
|
});
|
|
34
34
|
};
|