|
| 1 | +import faker from "faker"; |
| 2 | +import { ToastManager } from "./toast-manager"; |
| 3 | + |
1 | 4 | describe("ToastManager", () => { |
2 | | - test.skip("TODO: Backfill tests for issue https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/issues/34", () => {}); |
| 5 | + test("when error toast created, returns toastId", () => { |
| 6 | + // Arrange & Act |
| 7 | + const testToastId = faker.random.number(99); |
| 8 | + const toastContent = faker.random.word(); |
| 9 | + const toastOptions = { toastId: testToastId }; |
| 10 | + const toastId = ToastManager.error(toastContent, toastOptions); |
| 11 | + |
| 12 | + // Act |
| 13 | + expect(toastId).toBe(testToastId); |
| 14 | + }); |
| 15 | + |
| 16 | + test("when info toast created, returns toastId", () => { |
| 17 | + // Arrange & Act |
| 18 | + const testToastId = faker.random.number(99); |
| 19 | + const toastContent = faker.random.word(); |
| 20 | + const toastOptions = { toastId: testToastId }; |
| 21 | + const toastId = ToastManager.info(toastContent, toastOptions); |
| 22 | + |
| 23 | + // Act |
| 24 | + expect(toastId).toBe(testToastId); |
| 25 | + }); |
| 26 | + |
| 27 | + test("when success toast created, returns toastId", () => { |
| 28 | + // Arrange & Act |
| 29 | + const testToastId = faker.random.number(99); |
| 30 | + const toastContent = faker.random.word(); |
| 31 | + const toastOptions = { toastId: testToastId }; |
| 32 | + const toastId = ToastManager.success(toastContent, toastOptions); |
| 33 | + |
| 34 | + // Act |
| 35 | + expect(toastId).toBe(testToastId); |
| 36 | + }); |
| 37 | + |
| 38 | + test("when warn toast created, returns toastId", () => { |
| 39 | + // Arrange & Act |
| 40 | + const testToastId = faker.random.number(99); |
| 41 | + const toastContent = faker.random.word(); |
| 42 | + const toastOptions = { toastId: testToastId }; |
| 43 | + const toastId = ToastManager.warn(toastContent, toastOptions); |
| 44 | + |
| 45 | + // Act |
| 46 | + expect(toastId).toBe(testToastId); |
| 47 | + }); |
3 | 48 | }); |
0 commit comments