Skip to content

Commit

Permalink
fix large files
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed May 28, 2024
1 parent 035cba1 commit 808a0b6
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions examples/large_files/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dns.setDefaultResultOrder('ipv4first');
import { generateIdentity, getCanisterId } from 'azle/dfx';
import { hashFile } from 'azle/scripts/hash_file';
import { createActor } from 'azle/src/compiler/file_uploader/uploader_actor';
import { error, Test, testEquality } from 'azle/test';
import { error, fail, Test, test, testEquality } from 'azle/test';
import { execSync } from 'child_process';
import { rm } from 'fs/promises';
import { join } from 'path';
Expand Down Expand Up @@ -41,13 +41,13 @@ export function getTests(canisterId: string): Test[] {
4n
);
} catch (err: any) {
return {
Ok: err.message.includes(
return test(
err.message.includes(
'Not Authorized: only controllers of this canister may call this method'
)
};
);
}
return { Ok: false };
return fail();
}
},
{
Expand All @@ -60,13 +60,13 @@ export function getTests(canisterId: string): Test[] {
try {
await actor.get_hash_status('assets/test0B');
} catch (err: any) {
return {
Ok: err.message.includes(
return test(
err.message.includes(
'Not Authorized: only controllers of this canister may call this method'
)
};
);
}
return { Ok: false };
return fail();
}
},
{
Expand All @@ -79,13 +79,13 @@ export function getTests(canisterId: string): Test[] {
try {
await actor.get_file_hash('assets/test0B');
} catch (err: any) {
return {
Ok: err.message.includes(
return test(
err.message.includes(
'Not Authorized: only controllers of this canister may call this method'
)
};
);
}
return { Ok: false };
return fail();
}
},
{
Expand All @@ -98,13 +98,13 @@ export function getTests(canisterId: string): Test[] {
try {
await actor.clear_file_and_info('assets/test0B');
} catch (err: any) {
return {
Ok: err.message.includes(
return test(
err.message.includes(
'Not Authorized: only controllers of this canister may call this method'
)
};
);
}
return { Ok: false };
return fail();
}
},
...generateStandardFileTests('Upload', origin),
Expand Down Expand Up @@ -135,7 +135,7 @@ export function getTests(canisterId: string): Test[] {
`${origin}/exists?path=assets/test150MiB`
);

return { Ok: (await response.json()) === true };
return test(await response.json());
}
},
generateTest('manual test', origin, 'test150MiB', 'manual'),
Expand Down

0 comments on commit 808a0b6

Please sign in to comment.