25 lines
698 B
JavaScript
25 lines
698 B
JavaScript
import { settleAllPromises } from "@/helpers/layout-helper";
|
|
|
|
it("layout-helper: Should settle all promises and return mapped promise results", () => {
|
|
// Arrange
|
|
const mockPromiseOne = Promise.resolve({ data: "test-data" });
|
|
const mockPromiseTwo = Promise.resolve({ data: "test-data-two" });
|
|
|
|
const promiseResultMap = [
|
|
{
|
|
resultKey: "MockResultOne",
|
|
promise: mockPromiseOne,
|
|
},
|
|
{
|
|
resultKey: "MockResultTwo",
|
|
promise: mockPromiseTwo,
|
|
},
|
|
];
|
|
|
|
// Act
|
|
settleAllPromises(promiseResultMap).then((results) => {
|
|
// Assert
|
|
expect(results.MockResultOne).toEqual("test-data");
|
|
expect(results.MockResultTwo).toEqual("test-data-two");
|
|
});
|
|
});
|