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 all 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 @@ -17,7 +17,7 @@ export function generateTests(
{
name: `init method`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

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

const postUpgradeValues =
await actor.getPostUpgradeValues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod {
{
name: `pre upgrade was not called after first deploy`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor.getPreUpgradeExecuted();

return testEquality(result, []);
Expand All @@ -135,7 +135,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod {
{
name: `pre upgrade was called after second deploy`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);
const result = await actor.getPreUpgradeExecuted();

return testEquality(result, [true]);
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 @@ -54,7 +54,7 @@ function generateTests(
{
name: `containsKey after first deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
keySampleAgentArgumentValue
Expand All @@ -68,7 +68,7 @@ function generateTests(
{
name: `containsKey after second deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
keySampleAgentArgumentValue
Expand All @@ -82,7 +82,7 @@ function generateTests(
{
name: `containsKey after third deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
keySampleAgentArgumentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function generateTests(
{
name: `get after first deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
keySampleAgentArgumentValue
Expand All @@ -86,7 +86,7 @@ function generateTests(
{
name: `get after second deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
keySampleAgentArgumentValue
Expand All @@ -102,7 +102,7 @@ function generateTests(
{
name: `get after third deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
keySampleAgentArgumentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function generateTests(
{
name: `insert after first deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName](
keySampleAgentArgumentValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function generateTests(functionName: string): Test[][] {
{
name: `isEmpty after first deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName]();

Expand All @@ -56,7 +56,7 @@ function generateTests(functionName: string): Test[][] {
{
name: `isEmpty after second deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName]();

Expand All @@ -68,7 +68,7 @@ function generateTests(functionName: string): Test[][] {
{
name: `isEmpty after third deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName]();

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

const result = await actor[functionName]();

Expand All @@ -71,7 +71,7 @@ function generateTests(
{
name: `items after second deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName]();

Expand All @@ -88,7 +88,7 @@ function generateTests(
{
name: `items after third deploy ${functionName}`,
test: async (): Promise<AzleResult> => {
const actor = getActor(__dirname);
const actor = await getActor(__dirname);

const result = await actor[functionName]();

Expand Down
Loading
Loading