Skip to content

Commit

Permalink
feat(CB2-12690): removed any from expand test results
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Searle committed Jul 4, 2024
1 parent 53989ae commit 19e5129
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/services/TestResultsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import moment from "moment";
import { IInvokeConfig } from "../models";
import { Configuration } from "../utils/Configuration";
import { LambdaService } from "./LambdaService";
import { TestResultSchema } from "@dvsa/cvs-type-definitions/types/v1/test-result";
import { TestResultSchema, TestTypeSchema } from "@dvsa/cvs-type-definitions/types/v1/test-result";

class TestResultsService {
private readonly lambdaClient: LambdaService;
Expand Down Expand Up @@ -62,17 +62,17 @@ class TestResultsService {
* into multiple records with a single test type
* @param testResults
*/
public expandTestResults(testResults: any): any[] {
public expandTestResults(testResults: TestResultSchema[]): any[] {
console.debug("Splitting test results into multiple records");
return testResults
.map((testResult: any) => {
.map((testResult: TestResultSchema) => {
// Separate each test type in a record to form multiple test results
const splittedRecords: any[] = [];
const templateRecord: any = Object.assign({}, testResult);
const splittedRecords: TestResultSchema[] = [];
const templateRecord: TestResultSchema = Object.assign({}, testResult);
Object.assign(templateRecord, {});

testResult.testTypes.forEach((testType: any, i: number, array: any[]) => {
const clonedRecord: any = Object.assign({}, templateRecord); // Create test result from template
testResult.testTypes.forEach((testType: TestTypeSchema, i: number, array: any[]) => {
const clonedRecord: TestResultSchema = Object.assign({}, templateRecord); // Create test result from template
Object.assign(clonedRecord, { testTypes: testType }); // Assign it the test type

splittedRecords.push(clonedRecord);
Expand Down

0 comments on commit 19e5129

Please sign in to comment.