-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1033 from IntersectMBO/feat/extended-tests
Feat/extended tests
- Loading branch information
Showing
37 changed files
with
599 additions
and
137 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
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,5 @@ | ||
export function lovelaceToAda(lovelace: number) { | ||
if (lovelace === 0) return 0; | ||
|
||
return lovelace / 1e6; | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/govtool-frontend/playwright/lib/helpers/extractExpiryDateFromText.ts
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,29 @@ | ||
const monthNames = [ | ||
"Jan", | ||
"Feb", | ||
"Mar", | ||
"Apr", | ||
"May", | ||
"Jun", | ||
"Jul", | ||
"Aug", | ||
"Sep", | ||
"Oct", | ||
"Nov", | ||
"Dec", | ||
]; | ||
|
||
export default function extractExpiryDateFromText(text: string): Date | null { | ||
const regex = /(\d{1,2})th ([\w]{3}) (\d{4})/; | ||
const match = text.match(regex); | ||
|
||
if (match) { | ||
const day = parseInt(match[1]); | ||
const month = match[2]; | ||
const year = parseInt(match[3]); | ||
|
||
return new Date(year, monthNames.indexOf(month), day); | ||
} else { | ||
return null; | ||
} | ||
} |
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,13 @@ | ||
export class Logger { | ||
static success(msg: string) { | ||
console.debug(`\x1b[32m✔ ${msg}\x1b[0m`); // Green color | ||
} | ||
|
||
static fail(msg) { | ||
console.debug(`\x1b[33m✖ ${msg}\x1b[0m`); // Orange color | ||
} | ||
|
||
static info(msg: string) { | ||
console.debug(`\x1b[36mℹ ${msg}\x1b[0m`); // Cyan color | ||
} | ||
} |
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,13 @@ | ||
import { Download } from "@playwright/test"; | ||
import * as fs from "fs"; | ||
|
||
export async function downloadMetadata(download: Download): Promise<{ | ||
name: string; | ||
data: JSON; | ||
}> { | ||
const path = `.download/${download.suggestedFilename()}`; | ||
await download.saveAs(path); | ||
const fileContent = fs.readFileSync(path, "utf-8"); | ||
const jsonData = JSON.parse(fileContent); | ||
return { name: download.suggestedFilename(), data: jsonData }; | ||
} |
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
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
Oops, something went wrong.