Skip to content

Commit

Permalink
await get actor
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Dec 19, 2024
1 parent c991337 commit def8996
Show file tree
Hide file tree
Showing 59 changed files with 60 additions and 66 deletions.
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

0 comments on commit def8996

Please sign in to comment.