Skip to content

Commit

Permalink
fix blob type, fix Record
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Dec 6, 2023
1 parent fd555e0 commit 083f804
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function generateCandidTypeAnnotation(
([fieldName, fieldDefinition]) =>
`${fieldName}: ${fieldDefinition.candidMeta.candidTypeAnnotation}`
)
.join(',')}`;
.join(',')}}`;
}

function generateCandidTypeObject(
Expand Down
100 changes: 57 additions & 43 deletions property_tests/tests/stable_b_tree_map/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,22 @@ import { LenTestArb } from './len';
import { RemoveTestArb } from './remove';
import { ValuesTestArb } from './values';

const StableBTreeMapTestArb = StableBTreeMapArb.chain((stableBTreeMap) => {
return fc
.tuple(
ContainsKeyTestArb(stableBTreeMap)
// GetTestArb,
// IsEmptyTestArb,
// ItemsTestArb,
// KeysTestArb,
// LenTestArb,
// RemoveTestArb,
// ValuesTestArb
)
.map(
([
containsKeyTestQueryMethod
// getTestQueryMethod,
// isEmptyTestQueryMethod,
// itemsTestQueryMethod,
// keysTestQueryMethod,
// lenTestQueryMethod,
// removeTestQueryMethod,
// valuesTestQueryMethod
]) => {
return {
globalDeclarations: [stableBTreeMap.body],
queryMethods: [
const StableBTreeMapTestArb = fc
.array(
StableBTreeMapArb.chain((stableBTreeMap) => {
return fc
.tuple(
ContainsKeyTestArb(stableBTreeMap)
// GetTestArb,
// IsEmptyTestArb,
// ItemsTestArb,
// KeysTestArb,
// LenTestArb,
// RemoveTestArb,
// ValuesTestArb
)
.map(
([
containsKeyTestQueryMethod
// getTestQueryMethod,
// isEmptyTestQueryMethod,
Expand All @@ -55,23 +45,47 @@ const StableBTreeMapTestArb = StableBTreeMapArb.chain((stableBTreeMap) => {
// lenTestQueryMethod,
// removeTestQueryMethod,
// valuesTestQueryMethod
],
updateMethods: []
};
}
]) => {
return {
globalDeclarations: [stableBTreeMap.body],
queryMethods: [
containsKeyTestQueryMethod
// getTestQueryMethod,
// isEmptyTestQueryMethod,
// itemsTestQueryMethod,
// keysTestQueryMethod,
// lenTestQueryMethod,
// removeTestQueryMethod,
// valuesTestQueryMethod
],
updateMethods: []
};
}
);
}),
{
minLength: 10,
maxLength: 50
}
)
.map((canisterConfigs) => {
const globalDeclarations = canisterConfigs.flatMap(
(canisterConfig) => canisterConfig.globalDeclarations
);
});

// TODO we need to all adding in all of these methods
runPropTests(CanisterArb(StableBTreeMapTestArb));
const queryMethods = canisterConfigs.flatMap(
(canisterConfig) => canisterConfig.queryMethods
);

const updateMethods = canisterConfigs.flatMap(
(canisterConfig) => canisterConfig.updateMethods
);

return {
globalDeclarations,
queryMethods,
updateMethods
};
});

// runPropTests([
// ContainsKeyTestArb,
// GetTestArb,
// IsEmptyTestArb,
// ItemsTestArb,
// KeysTestArb,
// LenTestArb,
// RemoveTestArb,
// ValuesTestArb
// ]);
runPropTests(CanisterArb(StableBTreeMapTestArb));
2 changes: 1 addition & 1 deletion src/lib/candid/types/constructed/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class AzleBlob {
_azleKind: 'AzleBlob' = 'AzleBlob';
static _azleKind: 'AzleBlob' = 'AzleBlob';

static tsType: AzleBlob;
static tsType: blob;

static toBytes(data: any) {
return encode(this, data);
Expand Down

0 comments on commit 083f804

Please sign in to comment.