浏览代码

refactor: Tidied up InputHelpBox.spec.ts and locales

Owen Diffey 2 年之前
父节点
当前提交
a61efc4f1d

+ 1 - 1
.github/workflows/automated-tests.yml

@@ -24,7 +24,7 @@ env:
     REDIS_DATA_LOCATION: .redis
     REDIS_DATA_LOCATION: .redis
 
 
 jobs:
 jobs:
-    build-lint:
+    tests:
         runs-on: ubuntu-latest
         runs-on: ubuntu-latest
         steps:
         steps:
             - uses: actions/checkout@v3
             - uses: actions/checkout@v3

+ 12 - 45
frontend/src/components/InputHelpBox.spec.ts

@@ -22,53 +22,20 @@ describe("InputHelpBox component", () => {
 		);
 		);
 	});
 	});
 
 
-	describe("valid and entered props", () => {
-		test("valid and entered", async ({ wrapper }) => {
+	describe.each([
+		{ valid: true, entered: true, expected: "is-success" },
+		{ valid: true, entered: false, expected: "is-grey" },
+		{ valid: true, entered: undefined, expected: "is-success" },
+		{ valid: false, entered: true, expected: "is-danger" },
+		{ valid: false, entered: false, expected: "is-grey" },
+		{ valid: false, entered: undefined, expected: "is-danger" }
+	])("valid and entered props", ({ valid, entered, expected }) => {
+		test("class updated", async ({ wrapper }) => {
 			await wrapper.setProps({
 			await wrapper.setProps({
-				valid: true,
-				entered: true
+				valid,
+				entered
 			});
 			});
-			expect(wrapper.classes()).toContain("is-success");
-		});
-
-		test("valid and not entered", async ({ wrapper }) => {
-			await wrapper.setProps({
-				valid: true,
-				entered: false
-			});
-			expect(wrapper.classes()).toContain("is-grey");
-		});
-
-		test("valid and entered undefined", async ({ wrapper }) => {
-			await wrapper.setProps({
-				valid: true,
-				entered: undefined
-			});
-			expect(wrapper.classes()).toContain("is-success");
-		});
-
-		test("not valid and entered", async ({ wrapper }) => {
-			await wrapper.setProps({
-				valid: false,
-				entered: true
-			});
-			expect(wrapper.classes()).toContain("is-danger");
-		});
-
-		test("not valid and not entered", async ({ wrapper }) => {
-			await wrapper.setProps({
-				valid: false,
-				entered: false
-			});
-			expect(wrapper.classes()).toContain("is-grey");
-		});
-
-		test("not valid and entered undefined", async ({ wrapper }) => {
-			await wrapper.setProps({
-				valid: false,
-				entered: undefined
-			});
-			expect(wrapper.classes()).toContain("is-danger");
+			expect(wrapper.classes()).toContain(expected);
 		});
 		});
 	});
 	});
 });
 });

+ 7 - 1
frontend/src/locales/en-US.json

@@ -1,3 +1,9 @@
 {
 {
-    "favoriteStations": "My Favorites"
+    "login": "Login",
+    "register": "Register",
+    "station": "Station | Stations",
+    "manageStation": "Manage @:station",
+    "favoriteStations": "My Favorites",
+    "noStations": "There are no @.lower:station to display",
+    "home": "Home"
 }
 }

+ 0 - 9
frontend/src/locales/template.json

@@ -1,9 +0,0 @@
-{
-    "login": "",
-    "register": "",
-    "station": "",
-    "manageStation": "",
-    "favoriteStations": "",
-    "noStations": "",
-    "home": ""
-}