From e55e069efe6b5b96922682b5f3d18e1101ee23f9 Mon Sep 17 00:00:00 2001 From: Eric Crooks Date: Mon, 22 Jun 2020 07:46:01 -0400 Subject: [PATCH] fix before tests --- tests/integration/hooks/before_all_test.ts | 12 +++++------ tests/integration/hooks/before_each_test.ts | 24 +++++++++++++++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/integration/hooks/before_all_test.ts b/tests/integration/hooks/before_all_test.ts index 360c9006..46c2efd0 100644 --- a/tests/integration/hooks/before_all_test.ts +++ b/tests/integration/hooks/before_all_test.ts @@ -7,16 +7,16 @@ import { Rhum } from "../../../mod.ts"; let suite_val = "Ed"; let case_val = 22; -Rhum.testPlan("app_test.ts", () => { +Rhum.testPlan("before_all_test.ts", () => { Rhum.beforeAll(() => { suite_val = "Eric"; }); // Run the first test suite - Rhum.testSuite("run()", () => { + Rhum.testSuite("test suite 1", () => { Rhum.beforeAll(() => { case_val = 2; }); - Rhum.testCase("Returns true", () => { + Rhum.testCase("hooks properly set suite_val and case_val", () => { // Asserting the value has changed Rhum.asserts.assertEquals(suite_val, "Eric"); // Revert it back for the next test that uses it @@ -25,18 +25,18 @@ Rhum.testPlan("app_test.ts", () => { Rhum.asserts.assertEquals(case_val, 2); case_val = 22; }); - Rhum.testCase("Returns false", () => { + Rhum.testCase("hooks properly set case_val", () => { // Assert the value has changed from 22 to 2 (after setting it to 22 in the above case) Rhum.asserts.assertEquals(case_val, 2); }); }); // Run the second test suite - Rhum.testSuite("close()", () => { + Rhum.testSuite("test suite 2", () => { Rhum.beforeAll(() => { 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"; diff --git a/tests/integration/hooks/before_each_test.ts b/tests/integration/hooks/before_each_test.ts index 4367cca6..c40f8b2e 100644 --- a/tests/integration/hooks/before_each_test.ts +++ b/tests/integration/hooks/before_each_test.ts @@ -2,39 +2,49 @@ * Purpose of this test is to ensure a test using before_each succeeds */ -import { Rhum } from "../../mod.ts"; +import { Rhum } from "../../../mod.ts"; let suite_val = "Ed"; let case_val = 22; -Rhum.testPlan("app_test.ts", () => { +Rhum.testPlan("before_each_test.", () => { Rhum.beforeEach(() => { suite_val = "Eric"; }); // Run the first test suite - Rhum.testSuite("run()", () => { + Rhum.testSuite("test suite 1", () => { Rhum.beforeEach(() => { case_val = 2; }); - Rhum.testCase("Returns true", () => { + Rhum.testCase("suite_val is Eric", () => { Rhum.asserts.assertEquals(suite_val, "Eric"); suite_val = "Ed"; + }); + Rhum.testCase("suite_val is still Eric", () => { + Rhum.asserts.assertEquals(suite_val, "Eric"); + }); + Rhum.testCase("case_val is 2", () => { Rhum.asserts.assertEquals(case_val, 2); case_val = 22; }); - Rhum.testCase("Returns false", () => { + Rhum.testCase("case_val is still 2", () => { Rhum.asserts.assertEquals(case_val, 2); }); }); // Run the second test suite - Rhum.testSuite("close()", () => { + Rhum.testSuite("test suite 2", () => { Rhum.beforeEach(() => { case_val = 0; }); - Rhum.testCase("Returns true", async () => { + Rhum.testCase("suite_val is Eric", async () => { Rhum.asserts.assertEquals(suite_val, "Eric"); suite_val = "Ed"; + }); + Rhum.testCase("suite_val is still Eric", async () => { + Rhum.asserts.assertEquals(suite_val, "Eric"); + }); + Rhum.testCase("case_val is 0", () => { Rhum.asserts.assertEquals(case_val, 0); }); });