diff options
Diffstat (limited to 'test/bun.js/bun-test')
-rw-r--r-- | test/bun.js/bun-test/jest-hooks.test.ts | 195 | ||||
-rw-r--r-- | test/bun.js/bun-test/nested-describes.test.ts | 34 |
2 files changed, 0 insertions, 229 deletions
diff --git a/test/bun.js/bun-test/jest-hooks.test.ts b/test/bun.js/bun-test/jest-hooks.test.ts deleted file mode 100644 index c99dc7759..000000000 --- a/test/bun.js/bun-test/jest-hooks.test.ts +++ /dev/null @@ -1,195 +0,0 @@ -import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "bun:test"; - -describe("test jest hooks in bun-test", () => { - describe("test beforeAll hook", () => { - let animal = "tiger"; - - beforeAll(() => { - animal = "lion"; - }); - - it("string should be set by hook", () => { - expect(animal).toEqual("lion"); - }); - }); - - describe("test beforeEach hook", () => { - let animal = "tiger"; - - beforeEach(() => { - animal = "lion"; - }); - - it("string should be set by hook", () => { - expect(animal).toEqual("lion"); - animal = "dog"; - }); - - it("string should be re-set by hook", () => { - expect(animal).toEqual("lion"); - }); - }); - - describe("test afterEach hook", () => { - let animal = "tiger"; - - afterEach(() => { - animal = "lion"; - }); - - it("string should not be set by hook", () => { - expect(animal).toEqual("tiger"); - animal = "dog"; - }); - - it("string should be set by hook", () => { - expect(animal).toEqual("lion"); - }); - }); - - describe("test afterAll hook", () => { - let animal = "tiger"; - - describe("test afterAll hook", () => { - afterAll(() => { - animal = "lion"; - }); - - it("string should not be set by hook", () => { - expect(animal).toEqual("tiger"); - animal = "dog"; - }); - }); - - it("string should be set by hook", () => { - expect(animal).toEqual("lion"); - }); - }); - - describe("test async hooks", async () => { - let beforeAllCalled = 0; - let beforeEachCalled = 0; - let afterAllCalled = 0; - let afterEachCalled = 0; - - beforeAll(async () => { - beforeAllCalled += await 1; - }); - - beforeEach(async () => { - beforeEachCalled += await 1; - }); - - afterAll(async () => { - afterAllCalled += await 1; - }); - - afterEach(async () => { - afterEachCalled += await 1; - }); - - it("should run after beforeAll()", () => { - expect(beforeAllCalled).toBe(1); - expect(beforeEachCalled).toBe(1); - expect(afterAllCalled).toBe(0); - expect(afterEachCalled).toBe(0); - }); - - it("should run after beforeEach()", () => { - expect(beforeAllCalled).toBe(1); - expect(beforeEachCalled).toBe(2); - expect(afterAllCalled).toBe(0); - expect(afterEachCalled).toBe(1); - }); - }); - - describe("test done callback in hooks", () => { - let beforeAllCalled = 0; - let beforeEachCalled = 0; - let afterAllCalled = 0; - let afterEachCalled = 0; - - beforeAll(done => { - setImmediate(() => { - beforeAllCalled++; - done(); - }); - }); - - beforeEach(done => { - setImmediate(() => { - beforeEachCalled++; - done(); - }); - }); - - afterAll(done => { - setImmediate(() => { - afterAllCalled++; - done(); - }); - }); - - afterEach(done => { - setImmediate(() => { - afterEachCalled++; - done(); - }); - }); - - it("should run after beforeAll()", () => { - expect(beforeAllCalled).toBe(1); - expect(beforeEachCalled).toBe(1); - expect(afterAllCalled).toBe(0); - expect(afterEachCalled).toBe(0); - }); - - it("should run after beforeEach()", () => { - expect(beforeAllCalled).toBe(1); - expect(beforeEachCalled).toBe(2); - expect(afterAllCalled).toBe(0); - expect(afterEachCalled).toBe(1); - }); - }); - - describe("test async hooks with done()", () => { - let beforeAllCalled = 0; - let beforeEachCalled = 0; - let afterAllCalled = 0; - let afterEachCalled = 0; - - beforeAll(async done => { - beforeAllCalled += await 1; - setTimeout(done, 1); - }); - - beforeEach(async done => { - beforeEachCalled += await 1; - setTimeout(done, 1); - }); - - afterAll(async done => { - afterAllCalled += await 1; - setTimeout(done, 1); - }); - - afterEach(async done => { - afterEachCalled += await 1; - setTimeout(done, 1); - }); - - it("should run after beforeAll()", () => { - expect(beforeAllCalled).toBe(1); - expect(beforeEachCalled).toBe(1); - expect(afterAllCalled).toBe(0); - expect(afterEachCalled).toBe(0); - }); - - it("should run after beforeEach()", () => { - expect(beforeAllCalled).toBe(1); - expect(beforeEachCalled).toBe(2); - expect(afterAllCalled).toBe(0); - expect(afterEachCalled).toBe(1); - }); - }); -}); diff --git a/test/bun.js/bun-test/nested-describes.test.ts b/test/bun.js/bun-test/nested-describes.test.ts deleted file mode 100644 index 636714fdc..000000000 --- a/test/bun.js/bun-test/nested-describes.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { describe, expect, test } from "bun:test"; - -/* -In this test we want the tests to print out the following on a success. -Each success / fail should show the path of describe and test scopes - -✓ outer most describe > mid describe 1 > inner most describe 1 > first -✓ outer most describe > mid describe 1 > inner most describe 2 > second -✓ outer most describe > mid describe 2 > inner most describe 3 > first - -@TODO add testing for this, would require to read the test console output -*/ - -describe("outer most describe", () => { - describe("mid describe 1", () => { - describe("inner most describe 1", () => { - test("first", () => { - expect(5).toEqual(5); - }); - }); - describe("inner most describe 2", () => { - test("second", () => { - expect(5).toEqual(5); - }); - }); - }); - describe("mid describe 2", () => { - describe("inner most describe 3", () => { - test("third", () => { - expect(5).toEqual(5); - }); - }); - }); -}); |