aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/bun-test/jest-hooks.test.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/bun.js/bun-test/jest-hooks.test.ts76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/bun.js/bun-test/jest-hooks.test.ts b/test/bun.js/bun-test/jest-hooks.test.ts
new file mode 100644
index 000000000..a75025041
--- /dev/null
+++ b/test/bun.js/bun-test/jest-hooks.test.ts
@@ -0,0 +1,76 @@
+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");
+ });
+ });
+});