fix test name

This commit is contained in:
Nebel 2022-02-24 21:50:24 +09:00
parent 7d79b8d5a1
commit 494ca30619
2 changed files with 6 additions and 6 deletions

View file

@ -3,21 +3,21 @@
// ダミー
const fetchData = () => Promise.resolve("peanut butter");
test("the data is peanut butter", () => {
test("the data is peanut butter - return promise", () => {
return fetchData().then((data) => {
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");
});
test("the data is peanut butter", async () => {
test("the data is peanut butter - async/await", async () => {
const data = await fetchData();
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");
});

View file

@ -4,11 +4,11 @@ beforeAll(() => console.log("1 - beforeAll"));
afterAll(() => console.log("1 - afterAll"));
beforeEach(() => console.log("1 - beforeEach"));
afterEach(() => console.log("1 - afterEach"));
test("", () => console.log("1 - test"));
test("1 - test", () => console.log("1 - test"));
describe("Scoped / Nested block", () => {
beforeAll(() => console.log("2 - beforeAll"));
afterAll(() => console.log("2 - afterAll"));
beforeEach(() => console.log("2 - beforeEach"));
afterEach(() => console.log("2 - afterEach"));
test("", () => console.log("2 - test"));
test("2 - test", () => console.log("2 - test"));
});