Skip to content

Commit

Permalink
Merge pull request #2701 from demergent-labs/fix_release_tests
Browse files Browse the repository at this point in the history
Give `QueryMethod` type parameters
  • Loading branch information
lastmjs authored Feb 14, 2025
2 parents 5b40261 + 7759db8 commit 07e275a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/actions/get_exclude_dirs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ runs:
examples/experimental/test/end_to_end/http_server/http_outcall_fetch
examples/experimental/test/end_to_end/http_server/ic_evm_rpc
examples/experimental/test/end_to_end/http_server/multi_deploy
examples/experimental/test/end_to_end/http_server/open_value_sharing
examples/experimental/test/end_to_end/http_server/sqlite_drizzle
examples/experimental/test/property/candid_rpc/opt
examples/experimental/test/property/candid_rpc/stable_b_tree_map
Expand All @@ -52,7 +53,6 @@ runs:
examples/experimental/test/end_to_end/candid_rpc/stable_structures
examples/experimental/test/end_to_end/http_server/autoreload
examples/experimental/test/end_to_end/http_server/large_files
examples/experimental/test/end_to_end/http_server/open_value_sharing
') }}"
EXCLUDE_DIRS=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ export function getTests(canisterId: string): Test {

expect(responseJson).toEqual({
message:
'Rejection code 1, Header size exceeds specified response size limit 0'
'The inter-canister call failed with reject code 1: Header size exceeds specified response size limit 0',
rejectCode: 1,
rejectMessage:
'Header size exceeds specified response size limit 0'
});
});

Expand All @@ -219,7 +222,7 @@ export function getTests(canisterId: string): Test {
const responseJson = await response.json();

expect(responseJson.message).toMatch(
/Rejection code 4, http_request request sent with 0 cycles, but \d{1,3}(_\d{3})* cycles are required\./
/reject code 4: http_request request sent with 0 cycles, but \d{1,3}(_\d{3})* cycles are required\./
);
});
};
Expand Down
9 changes: 6 additions & 3 deletions test/property/arbitraries/canister_arb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type CanisterMethod<
ParamAgentArgumentValue extends CorrespondingJSType,
ParamAgentResponseValue
> =
| QueryMethod
| QueryMethod<ParamAgentArgumentValue, ParamAgentResponseValue>
| UpdateMethod<ParamAgentArgumentValue, ParamAgentResponseValue>
| InitMethod<ParamAgentArgumentValue, ParamAgentResponseValue>
| PostUpgradeMethod<ParamAgentArgumentValue, ParamAgentResponseValue>
Expand All @@ -41,7 +41,10 @@ export type CanisterConfig<
ParamAgentResponseValue
>;
preUpgradeMethod?: PreUpgradeMethod;
queryMethods?: QueryMethod[];
queryMethods?: QueryMethod<
ParamAgentArgumentValue,
ParamAgentResponseValue
>[];
updateMethods?: UpdateMethod<
ParamAgentArgumentValue,
ParamAgentResponseValue
Expand Down Expand Up @@ -139,7 +142,7 @@ function generateSourceCode<
globalDeclarations: string[],
canisterMethods: (
| UpdateMethod<ParamAgentArgumentValue, ParamAgentResponseValue>
| QueryMethod
| QueryMethod<ParamAgentArgumentValue, ParamAgentResponseValue>
)[],
api: Api,
inspectMessageImportHack?: boolean
Expand Down
12 changes: 9 additions & 3 deletions test/property/arbitraries/canister_methods/query_method_arb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import {
TestsGenerator
} from '.';

export type QueryMethod = {
export type QueryMethod<
_ParamAgentArgumentValue extends CorrespondingJSType,
_ParamAgentResponseValue
> = {
imports: Set<string>;
globalDeclarations: string[];
sourceCode: string;
Expand Down Expand Up @@ -53,7 +56,7 @@ export function QueryMethodArb<
ReturnTypeAgentResponseValue
>
>
): fc.Arbitrary<QueryMethod> {
): fc.Arbitrary<QueryMethod<ParamAgentArgumentValue, ParamAgentResponseValue>> {
const api = context.api;
const constraints = context.constraints;
return fc
Expand All @@ -74,7 +77,10 @@ export function QueryMethodArb<
returnType,
defaultMethodImplementationLocation,
methodName
]): QueryMethod => {
]): QueryMethod<
ParamAgentArgumentValue,
ParamAgentResponseValue
> => {
const methodImplementationLocation =
api === 'class'
? 'INLINE'
Expand Down

0 comments on commit 07e275a

Please sign in to comment.