-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
149 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,32 @@ | ||
import useGiven from "../../../src/jasmine"; | ||
import Given from "../../../src/Given"; | ||
|
||
const { letGiven, it, fit, xit } = useGiven<{ | ||
interface letGiven { | ||
five: number; | ||
six: number; | ||
}>(); | ||
} | ||
|
||
describe("Example", () => { | ||
letGiven('five', () => 5); | ||
|
||
it("simple test", ({ five }) => { | ||
expect(five).toEqual(5); | ||
}); | ||
|
||
xit("skipped", ({ five }) => { | ||
expect(five).toEqual(5); | ||
}); | ||
|
||
describe("nested", () => { | ||
letGiven('six', () => 6); | ||
|
||
it("simple test", ({ five, six }) => { | ||
expect(five).toEqual(5); | ||
expect(six).toEqual(6); | ||
}); | ||
}); | ||
|
||
it("where not defined", ({ six }) => { | ||
expect(six).toEqual(undefined); | ||
}); | ||
|
||
describe("overriding", () => { | ||
letGiven('five', () => 6) | ||
|
||
it("correct", ({ five }) => { | ||
expect(five).not.toEqual(5); | ||
}) | ||
}); | ||
|
||
describe("dependencies given", () => { | ||
letGiven('six', async ({ five }) => five + 1, ['five']); | ||
const given = new Given<letGiven>(); | ||
|
||
it("correct", ({ six }) => { | ||
expect(six).toEqual(6); | ||
}); | ||
|
||
describe("changed in nested describe", () => { | ||
letGiven('five', () => 10); | ||
|
||
it("correct used new value", ({ six }) => { | ||
expect(six).toEqual(11); | ||
}); | ||
}); | ||
describe("Example", () => { | ||
beforeEach(() => { | ||
given.add('five', () => 5); | ||
}); | ||
|
||
describe("super", () => { | ||
letGiven('five', ({ five }) => five + 5, ['five']); | ||
|
||
it("success", ({ five }) => { | ||
expect(five).toEqual(10); | ||
}); | ||
|
||
describe("nested", () => { | ||
letGiven('five', ({ five }) => five - 2, ['five']); | ||
|
||
it("success", ({ five }) => { | ||
expect(five).toEqual(8); | ||
}); | ||
it("simple test", async () => { | ||
const { five } = await given.loadValues(); | ||
|
||
describe("depend from another given", () => { | ||
letGiven('six', () => 6); | ||
letGiven('five', ({ five, six }) => five + six, ['five', 'six']); | ||
|
||
it("success", ({ five }) => { | ||
expect(five).toEqual(14); | ||
}); | ||
}); | ||
}); | ||
expect(five).toEqual(5); | ||
}); | ||
|
||
describe("specify dependencies", () => { | ||
letGiven('six', ({ five }) => five + 1, ['five']) | ||
|
||
it("correct", ({ six }) => { | ||
expect(six).toEqual(6); | ||
describe("circular dependency", () => { | ||
beforeEach(() => { | ||
given.add('five', ({ six }) => six + 5, ['six']); | ||
}); | ||
|
||
describe("with async", () => { | ||
letGiven('six', async ({ five }) => five + 2, ['five']); | ||
|
||
it("correct", ({ six }) => { | ||
expect(six).toEqual(7); | ||
}); | ||
}); | ||
|
||
describe("changed in nested describe", () => { | ||
letGiven('five', () => 10); | ||
|
||
it("correct used new value", ({ six }) => { | ||
expect(six).toEqual(11); | ||
}); | ||
it("throw error", () => { | ||
expect(() => { | ||
given.add('six', ({ five }) => five + 5, ['five']) | ||
}).toThrow("letGiven 'six' circular dependency"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import useGiven from "../../../src/jasmine"; | ||
|
||
const { letGiven, it, fit, xit } = useGiven<{ | ||
five: number; | ||
six: number; | ||
}>(); | ||
|
||
describe("Example", () => { | ||
letGiven('five', () => 5); | ||
|
||
it("simple test", ({ five }) => { | ||
expect(five).toEqual(5); | ||
}); | ||
|
||
xit("skipped", ({ five }) => { | ||
expect(five).toEqual(5); | ||
}); | ||
|
||
describe("nested", () => { | ||
letGiven('six', () => 6); | ||
|
||
it("simple test", ({ five, six }) => { | ||
expect(five).toEqual(5); | ||
expect(six).toEqual(6); | ||
}); | ||
}); | ||
|
||
it("where not defined", ({ six }) => { | ||
expect(six).toEqual(undefined); | ||
}); | ||
|
||
describe("overriding", () => { | ||
letGiven('five', () => 6) | ||
|
||
it("correct", ({ five }) => { | ||
expect(five).not.toEqual(5); | ||
}) | ||
}); | ||
|
||
describe("dependencies given", () => { | ||
letGiven('six', async ({ five }) => five + 1, ['five']); | ||
|
||
it("correct", ({ six }) => { | ||
expect(six).toEqual(6); | ||
}); | ||
|
||
describe("changed in nested describe", () => { | ||
letGiven('five', () => 10); | ||
|
||
it("correct used new value", ({ six }) => { | ||
expect(six).toEqual(11); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("super", () => { | ||
letGiven('five', ({ five }) => five + 5, ['five']); | ||
|
||
it("success", ({ five }) => { | ||
expect(five).toEqual(10); | ||
}); | ||
|
||
describe("nested", () => { | ||
letGiven('five', ({ five }) => five - 2, ['five']); | ||
|
||
it("success", ({ five }) => { | ||
expect(five).toEqual(8); | ||
}); | ||
|
||
describe("depend from another given", () => { | ||
letGiven('six', () => 6); | ||
letGiven('five', ({ five, six }) => five + six, ['five', 'six']); | ||
|
||
it("success", ({ five }) => { | ||
expect(five).toEqual(14); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("specify dependencies", () => { | ||
letGiven('six', ({ five }) => five + 1, ['five']) | ||
|
||
it("correct", ({ six }) => { | ||
expect(six).toEqual(6); | ||
}); | ||
|
||
describe("with async", () => { | ||
letGiven('six', async ({ five }) => five + 2, ['five']); | ||
|
||
it("correct", ({ six }) => { | ||
expect(six).toEqual(7); | ||
}); | ||
}); | ||
|
||
describe("changed in nested describe", () => { | ||
letGiven('five', () => 10); | ||
|
||
it("correct used new value", ({ six }) => { | ||
expect(six).toEqual(11); | ||
}); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.