mirror of
https://github.com/kou029w/jest-hands-on.git
synced 2025-02-01 06:08:38 +00:00
23 lines
618 B
JavaScript
23 lines
618 B
JavaScript
/** @license https://github.com/facebook/jest/blob/master/LICENSE */
|
|
|
|
// ダミー
|
|
const fetchData = () => Promise.resolve("peanut butter");
|
|
|
|
test("the data is peanut butter", () => {
|
|
return fetchData().then((data) => {
|
|
expect(data).toBe("peanut butter");
|
|
});
|
|
});
|
|
|
|
test("the data is peanut butter", () => {
|
|
return expect(fetchData()).resolves.toBe("peanut butter");
|
|
});
|
|
|
|
test("the data is peanut butter", async () => {
|
|
const data = await fetchData();
|
|
expect(data).toBe("peanut butter");
|
|
});
|
|
|
|
test("the data is peanut butter", async () => {
|
|
await expect(fetchData()).resolves.toBe("peanut butter");
|
|
});
|