Skip to content

Commit

Permalink
remove temp test framework code
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jul 17, 2024
1 parent a642ad4 commit db16cf1
Showing 1 changed file with 7 additions and 35 deletions.
42 changes: 7 additions & 35 deletions property_tests/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ export type Test<> = {
test?: () => Promise<AzleResult>;
};

// TODO get rid of this union once the jest migration is complete
export type AzleResult =
| Partial<{
Ok: { isSuccessful: boolean; message?: string };
Err: string;
}>
| Partial<{ Ok: boolean; Err: string }>;
export type AzleResult = Partial<{
Ok: { isSuccessful: boolean; message?: string };
Err: string;
}>;

// TODO should this just return a boolean?
// TODO then the function calling can decide to throw or not
Expand Down Expand Up @@ -74,20 +71,10 @@ export async function runTests(
}
}

// TODO replace this with the below commented out code once jest migration is complete
const message =
typeof result.Ok === 'object' && result.Ok !== null
? result.Ok.message
: undefined;
const successful =
typeof result.Ok === 'boolean'
? result.Ok
: result.Ok.isSuccessful;

if (successful !== true) {
if (result.Ok.isSuccessful !== true) {
console.info('\x1b[31m', `test: ${test.name} failed`);
if (message !== undefined) {
console.info('\x1b[31m', `${message}`);
if (result.Ok.message !== undefined) {
console.info('\x1b[31m', `${result.Ok.message}`);
}
console.info('\x1b[0m');

Expand All @@ -98,21 +85,6 @@ export async function runTests(
}
}

// TODO bring this back once jest migration is complete
// if (result.Ok.isSuccessful !== true) {
// console.info('\x1b[31m', `test: ${test.name} failed`);
// if (result.Ok.message !== undefined) {
// console.info('\x1b[31m', `${result.Ok.message}`);
// }
// console.info('\x1b[0m');

// if (exitProcess) {
// process.exit(1);
// } else {
// return false;
// }
// }

console.info('\x1b[32m', `test: ${test.name} passed`);
console.info('\x1b[0m');
} catch (error) {
Expand Down

0 comments on commit db16cf1

Please sign in to comment.