Skip to content

Commit 9d9b405

Browse files
authored
Merge pull request #8 from open-rpc/fix/results-validation
fix: pass correct call results to reporter + fix ajv validate
2 parents 8b93468 + fa0ae35 commit 9d9b405

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/coverage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ export default async (options: IOptions) => {
4040
}))
4141
});
4242

43-
const callResults = await Promise.all(promises);
44-
options.reporter(callResults, options.schema);
43+
await Promise.all(promises);
44+
options.reporter(results, options.schema);
4545
}

src/reporters/console.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default (callResults: any[], schema: OpenRPC) => {
88
errors: 0,
99
success: 0
1010
}
11+
1112
callResults.forEach((call) => {
1213
if (call.error) {
1314
metrics.errors++;
@@ -21,7 +22,7 @@ export default (callResults: any[], schema: OpenRPC) => {
2122
return console.log(`Error: no result defined for ${call.method}`);
2223
}
2324

24-
const isValid = ajv.validate((methodSchema.result as ContentDescriptorObject).schema, `${call.method}/results`);
25+
const isValid = ajv.validate((methodSchema.result as ContentDescriptorObject).schema, call.result);
2526
const errors = ajv.errors as ErrorObject[];
2627

2728
if (isValid) {

0 commit comments

Comments
 (0)