mirror of
https://github.com/kou029w/jest-hands-on.git
synced 2025-01-31 22:08:00 +00:00
fix test name
This commit is contained in:
parent
7d79b8d5a1
commit
494ca30619
2 changed files with 6 additions and 6 deletions
|
@ -3,21 +3,21 @@
|
||||||
// ダミー
|
// ダミー
|
||||||
const fetchData = () => Promise.resolve("peanut butter");
|
const fetchData = () => Promise.resolve("peanut butter");
|
||||||
|
|
||||||
test("the data is peanut butter", () => {
|
test("the data is peanut butter - return promise", () => {
|
||||||
return fetchData().then((data) => {
|
return fetchData().then((data) => {
|
||||||
expect(data).toBe("peanut butter");
|
expect(data).toBe("peanut butter");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the data is peanut butter", () => {
|
test("the data is peanut butter - return promise with resolves", () => {
|
||||||
return expect(fetchData()).resolves.toBe("peanut butter");
|
return expect(fetchData()).resolves.toBe("peanut butter");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the data is peanut butter", async () => {
|
test("the data is peanut butter - async/await", async () => {
|
||||||
const data = await fetchData();
|
const data = await fetchData();
|
||||||
expect(data).toBe("peanut butter");
|
expect(data).toBe("peanut butter");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the data is peanut butter", async () => {
|
test("the data is peanut butter - async/await with resolves", async () => {
|
||||||
await expect(fetchData()).resolves.toBe("peanut butter");
|
await expect(fetchData()).resolves.toBe("peanut butter");
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,11 +4,11 @@ beforeAll(() => console.log("1 - beforeAll"));
|
||||||
afterAll(() => console.log("1 - afterAll"));
|
afterAll(() => console.log("1 - afterAll"));
|
||||||
beforeEach(() => console.log("1 - beforeEach"));
|
beforeEach(() => console.log("1 - beforeEach"));
|
||||||
afterEach(() => console.log("1 - afterEach"));
|
afterEach(() => console.log("1 - afterEach"));
|
||||||
test("", () => console.log("1 - test"));
|
test("1 - test", () => console.log("1 - test"));
|
||||||
describe("Scoped / Nested block", () => {
|
describe("Scoped / Nested block", () => {
|
||||||
beforeAll(() => console.log("2 - beforeAll"));
|
beforeAll(() => console.log("2 - beforeAll"));
|
||||||
afterAll(() => console.log("2 - afterAll"));
|
afterAll(() => console.log("2 - afterAll"));
|
||||||
beforeEach(() => console.log("2 - beforeEach"));
|
beforeEach(() => console.log("2 - beforeEach"));
|
||||||
afterEach(() => console.log("2 - afterEach"));
|
afterEach(() => console.log("2 - afterEach"));
|
||||||
test("", () => console.log("2 - test"));
|
test("2 - test", () => console.log("2 - test"));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue