Skip to content

Commit

Permalink
update names
Browse files Browse the repository at this point in the history
  • Loading branch information
crookse committed Jun 22, 2020
1 parent e55e069 commit d26bcf8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
13 changes: 7 additions & 6 deletions tests/integration/hooks/after_all_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,36 @@ import { Rhum } from "../../../mod.ts";
let suite_val = "Ed";
let case_val = 22;

Rhum.testPlan("app_test.ts", () => {
Rhum.testPlan("after_all_test.ts", () => {

Rhum.afterAll(() => {
suite_val = "Eric";
});
// Run the first test suite
Rhum.testSuite("run()", () => {
Rhum.testSuite("test suite 1", () => {
Rhum.afterAll(() => {
case_val = 2;
});
Rhum.testCase("Returns true", () => {
Rhum.testCase("hooks properly set suite_val and case_val", () => {
// Asserting that the suite val should not have been changed by the hook (yet)
Rhum.asserts.assertEquals(suite_val, "Ed");
// Revert it back for the next test that uses it
suite_val = "Ed";
// Assert the value is kept the same (hook hasn't ran yet)
Rhum.asserts.assertEquals(case_val, 22);
});
Rhum.testCase("Returns false", () => {
Rhum.testCase("hooks properly set case_val", () => {
// Assert the value has changes as the hook should have ran
Rhum.asserts.assertEquals(case_val, 2);
});
});

// Run the second test suite
Rhum.testSuite("close()", () => {
Rhum.testSuite("test suite 2", () => {
Rhum.afterAll(() => {
case_val = 0;
});
Rhum.testCase("Returns true", async () => {
Rhum.testCase("hooks properly set suite_val and case_val", async () => {
// Asserting the hook should have replaced the name
Rhum.asserts.assertEquals(suite_val, "Eric");
suite_val = "Ed";
Expand Down
11 changes: 6 additions & 5 deletions tests/integration/hooks/after_each_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import { Rhum } from "../../../mod.ts";
let suite_val = "Ed";
let case_val = 22;

Rhum.testPlan("app_test.ts", () => {
Rhum.testPlan("after_each_test.ts", () => {

Rhum.afterEach(() => {
suite_val = "Eric";
});
// Run the first test suite
Rhum.testSuite("run()", () => {
Rhum.testSuite("test suite 1", () => {
Rhum.afterEach(() => {
case_val = 2;
});
Rhum.testCase("Returns true", () => {
Rhum.testCase("hooks properly set suite_val and case_val", () => {
// Asserting that the suite val should not have been changed by the hook (yet)
Rhum.asserts.assertEquals(suite_val, "Ed");
// Revert it back for the next test that uses it
Expand All @@ -31,11 +32,11 @@ Rhum.testPlan("app_test.ts", () => {
});

// Run the second test suite
Rhum.testSuite("close()", () => {
Rhum.testSuite("test suite 2", () => {
Rhum.afterEach(() => {
case_val = 0;
});
Rhum.testCase("Returns true", async () => {
Rhum.testCase("hooks properly set suite_val and case_val", async () => {
// Asserting the hook should have replaced the name
Rhum.asserts.assertEquals(suite_val, "Eric");
suite_val = "Ed";
Expand Down
1 change: 1 addition & 0 deletions tests/integration/hooks/before_all_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let suite_val = "Ed";
let case_val = 22;

Rhum.testPlan("before_all_test.ts", () => {

Rhum.beforeAll(() => {
suite_val = "Eric";
});
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/hooks/before_each_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Rhum } from "../../../mod.ts";
let suite_val = "Ed";
let case_val = 22;

Rhum.testPlan("before_each_test.", () => {
Rhum.testPlan("before_each_test.ts", () => {

Rhum.beforeEach(() => {
suite_val = "Eric";
});
Expand Down

0 comments on commit d26bcf8

Please sign in to comment.