Skip to content

Commit

Permalink
simple pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jan 17, 2024
1 parent 43d286d commit 4ffda3f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
13 changes: 6 additions & 7 deletions property_tests/arbitraries/canister_arb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ export function CanisterArb<
...(config.updateMethods ?? [])
];

const deployArgs = config.initMethod?.params.map(
({ value: { value } }) => {
return value.runtimeCandidTypeObject
.getIdl([])
.valueToString(value.agentArgumentValue);
}
);
const deployArgs = config.initMethod?.params.map((param) => {
const value = param.value.value;
return value.runtimeCandidTypeObject
.getIdl([])
.valueToString(value.agentArgumentValue);
});

const sourceCode = generateSourceCode(
config.globalDeclarations ?? [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function InitMethodArb<
>;
callbackLocation?: CallbackLocation;
}
) {
): fc.Arbitrary<InitMethod<ParamAgentArgumentValue, ParamAgentResponseValue>> {
return fc
.tuple(
UniqueIdentifierArb('canisterMethod'),
Expand Down
18 changes: 9 additions & 9 deletions property_tests/arbitraries/canister_methods/post_upgrade_arb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ export function PostUpgradeMethodArb<
>;
callbackLocation?: CallbackLocation;
}
) {
): fc.Arbitrary<
PostUpgradeMethod<ParamAgentArgumentValue, ParamAgentResponseValue>
> {
return fc
.tuple(
UniqueIdentifierArb('canisterMethod'),
paramTypeArrayArb,
VoidArb(),
fc.constantFrom(
'INLINE',
'STANDALONE'
) as fc.Arbitrary<CallbackLocation>,
fc.constantFrom<CallbackLocation>('INLINE', 'STANDALONE'),
UniqueIdentifierArb('typeDeclaration')
// TODO: This unique id would be better named globalScope or something
// But needs to match the same scope as typeDeclarations so I'm using
Expand All @@ -67,9 +66,10 @@ export function PostUpgradeMethodArb<
returnType,
defaultCallbackLocation,
callbackName
]) => {
// TODO: Add a return type to this map callback of type PostUpgradeMethod<Something, Something>

]): PostUpgradeMethod<
ParamAgentArgumentValue,
ParamAgentResponseValue
> => {
const callbackLocation =
constraints.callbackLocation ?? defaultCallbackLocation;

Expand All @@ -81,7 +81,7 @@ export function PostUpgradeMethodArb<
const namedParams = paramTypes.map(
<T>(param: T, index: number): Named<T> => ({
name: `param${index}`,
el: param
value: param
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function generateTests(
): Test[][] {
const expectedResult = [
true,
...params.map((param) => param.el.value.agentResponseValue)
...params.map((param) => param.value.value.agentResponseValue)
];

return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function generateTests(
): Test[][] {
const expectedResult = [
true,
...params.map((param) => param.el.value.agentResponseValue)
...params.map((param) => param.value.value.agentResponseValue)
];

return [
Expand Down
2 changes: 1 addition & 1 deletion property_tests/tests/post_upgrade_method/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fc from 'fast-check';

import { runPropTests } from 'azle/property_tests';
import { CandidValueAndMetaArbWithoutFuncs as CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb';
import {
CanisterArb,
Expand Down

0 comments on commit 4ffda3f

Please sign in to comment.