forked from ytgov/travel-authorization
-
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.
⚙️ Add minimal front-end testing setup for js files.
Why? so I can test the parse travel function.
- Loading branch information
1 parent
8451a17
commit c741a00
Showing
7 changed files
with
85 additions
and
1 deletion.
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
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
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,8 @@ | ||
// Helps VSCode detect typescript path aliases in test files | ||
{ | ||
"extends": "../jsconfig.json", | ||
"include": ["./**/*.test.js"], | ||
"compilerOptions": { | ||
"types": ["vitest/globals"] // https://vitest.dev/config/#globals | ||
} | ||
} |
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,25 @@ | ||
import { parseTravel } from "@/utils/parse-travel" | ||
|
||
describe("web/src/utils/parse-travel.js", () => { | ||
describe(".parseTravel", () => { | ||
test("when given two flights from Air Canada, parses them correctly", () => { | ||
const text = `Flights: | ||
Air Canada AC303 | ||
Departure: 13 Jan 09:05 Pierre Elliott Trudeau Intl Arpt (YUL) Terminal: | ||
Arrival: 13 Jan 11:53 Vancouver Intl Arpt (YVR) Terminal: M | ||
Duration: 5 Hour(s) 48 Minutes | ||
Status: Confirmed | ||
Class: Q | ||
Air Canada AC8099 - Operated By: AIR CANADA EXPRESS - JAZZ | ||
Departure: 13 Jan 13:55 Vancouver Intl Arpt (YVR) Terminal: M | ||
Arrival: 13 Jan 17:19 Whitehorse Arpt (YXY) Terminal: | ||
Duration: 3 Hour(s) 24 Minutes | ||
Status: Confirmed | ||
Class: Q | ||
` | ||
const result = parseTravel(text) | ||
|
||
expect(result).toEqual("will fail, not implemented") | ||
}) | ||
}) | ||
}) |
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,15 @@ | ||
/// <reference types="vitest" /> | ||
import path from "path" | ||
|
||
// Add @vitejs/plugin-vue2 if you want to test vue files. | ||
export default { | ||
resolve: { | ||
alias: { | ||
"@/": `${path.resolve(__dirname, "src")}/`, | ||
}, | ||
extensions: [".js", ".json", ".mjs", ".vue"], | ||
}, | ||
test: { | ||
globals: true, // https://vitest.dev/config/#globals | ||
}, | ||
} |