Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All prop tests use getCanisterActor #2361

Merged
merged 17 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function generateTests(
{
name: `blob ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...paramBlobs.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function generateTests(
{
name: `bool ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function generateTests(
{
name: 'get state before calling http_request',
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor['get_state']();

Expand Down Expand Up @@ -62,7 +62,7 @@ export function generateTests(
{
name: 'get state after calling http_request',
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor['get_state']();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function generateTests(
{
name: `init method`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor.getInitValues();

return testEquality(result, expectedResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function generateTest(
name: `method "${functionName}" expected ${behavior}`,
test: async (): Promise<AzleResult> => {
await agent.fetchRootKey();
const actor = getActor(__dirname, agent);
const actor = await getActor(__dirname, agent);
try {
const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateTests(
{
name: `query method "${functionName}"`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor[functionName](...paramValues);
return testEquality(result, expectedResult);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateTests(
{
name: `update method "${functionName}"`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor[functionName](...paramValues);

return testEquality(result, expectedResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateTests(
{
name: `float32 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `float64 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function generateTests(
{
name: `func ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...namedParamFuncs.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function generateTests(
{
name: `int ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `int16 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `int32 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function generateTests(
{
name: `int64 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function generateTests(
{
name: `test ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function generateTests(
{
name: `nat ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `nat16 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `nat32 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function generateTests(
{
name: `nat64 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `nat8 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function generateTests(
{
name: `test ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...namedParamNulls.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function generateTests(
{
name: `opt ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const params = namedParamOpts.map(
(param) => param.value.value.agentArgumentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function generateTests(
{
name: `principal ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor[functionName](
...namedParamPrincipals.map(
(param) => param.value.value.agentArgumentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function generateTests(
{
name: `record ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...namedParamRecords.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function generateTests(
{
name: `recursive ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const params = namedParamRecursive.map(
(param) => param.value.value.agentArgumentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function generateTests(
{
name: `text ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function generateTests(
{
name: `tuple ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...namedParamTuples.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function generateTests(
{
name: `variant ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...namedParamVariants.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function generateTests(
{
name: `vec ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const params = namedParamVecs.map(
(param) => param.value.value.agentArgumentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function generateTests(
{
name: `blob ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...paramBlobs.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function generateTests(
{
name: `bool ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function generateTests(
{
name: 'get state before calling http_request',
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor['get_state']();

Expand Down Expand Up @@ -62,7 +62,7 @@ export function generateTests(
{
name: 'get state after calling http_request',
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor['get_state']();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function generateTests(
{
name: `init method`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor.getInitValues();

return testEquality(result, expectedResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function generateTest(
name: `method "${functionName}" expected ${behavior}`,
test: async (): Promise<AzleResult> => {
await agent.fetchRootKey();
const actor = getActor(__dirname, agent);
const actor = await getActor(__dirname, agent);
try {
const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateTests(
{
name: `query method "${functionName}"`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor[functionName](...paramValues);
return testEquality(result, expectedResult);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateTests(
{
name: `update method "${functionName}"`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor[functionName](...paramValues);

return testEquality(result, expectedResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateTests(
{
name: `float32 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `float64 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function generateTests(
{
name: `func ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
...namedParamFuncs.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function generateTests(
{
name: `int ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `int16 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function generateTests(
{
name: `int32 ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](...paramValues);

Expand Down
Loading
Loading