From 1ef8ef2748044b2c70b9736927c87df6730cbd4b Mon Sep 17 00:00:00 2001 From: DivyanshuVorrtex Date: Thu, 7 May 2026 08:13:24 +0000 Subject: [PATCH 1/2] format_date --- package-lock.json | 5 +++++ src/microcks-container.test.ts | 4 +++- src/microcks-container.ts | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index cbe2882..8b52e21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2672,6 +2672,7 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.29.tgz", "integrity": "sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ==", "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -5984,6 +5985,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -6120,6 +6122,7 @@ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -6207,6 +6210,7 @@ "integrity": "sha512-4nVGliEpxmhCL8DslSAUdxlB6+SMrhB0a1v5ijlh1xB1nEPuy1mxaHxysVucLHuWryAxLWg6a5ei+U4TLn/rFg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -6323,6 +6327,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, diff --git a/src/microcks-container.test.ts b/src/microcks-container.test.ts index 01415ab..fb03814 100644 --- a/src/microcks-container.test.ts +++ b/src/microcks-container.test.ts @@ -135,7 +135,9 @@ describe("MicrocksContainer", () => { async function testInvocationsCheckingFunctionality(container: StartedMicrocksContainer, serviceName: string, serviceVersion: string, expectedCount: number) { expect(await container.verify(serviceName, serviceVersion)).toBe(true); - expect(await container.getServiceInvocationsCount(serviceName, serviceVersion)).toBe(expectedCount) + expect(await container.getServiceInvocationsCount(serviceName, serviceVersion)).toBe(expectedCount); + expect(await container.verify(serviceName, serviceVersion, new Date())).toBe(true); + expect(await container.getServiceInvocationsCount(serviceName, serviceVersion, new Date())).toBe(expectedCount); } // start and contract test { diff --git a/src/microcks-container.ts b/src/microcks-container.ts index b532d7f..c0ac9c8 100644 --- a/src/microcks-container.ts +++ b/src/microcks-container.ts @@ -505,7 +505,7 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { }); if (response.status != 201) { - throw new Error("Secret has not been correctly created: " + await response.json()); + throw new Error("Secret has not been correctly created: " + await response.text()); } } @@ -536,7 +536,7 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { } return testResult; } - throw new Error("Couldn't launch on new test on Microcks. Please check Microcks container logs."); + throw new Error("Couldn't launch a new test on Microcks. Please check Microcks container logs."); } /** @@ -561,7 +561,7 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { const responseJson = await response.json(); return responseJson as RequestResponsePair[]; } - throw new Error("Couldn't retrieve messages on test on Microcks. Please check Microcks container logs"); + throw new Error("Couldn't retrieve messages for test on Microcks. Please check Microcks container logs"); } /** @@ -586,7 +586,7 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { const responseJson = await response.json(); return responseJson as UnidirectionalEvent[]; } - throw new Error("Couldn't retrieve event messages on test on Microcks. Please check Microcks container logs"); + throw new Error("Couldn't retrieve event messages for test on Microcks. Please check Microcks container logs"); } /** @@ -623,7 +623,7 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { private async importArtifact(artifactPath: string, mainArtifact: boolean): Promise { const isFile = await this.isFile(artifactPath); if (!isFile) { - throw new Error(`Artifact ${artifactPath} does not exist or can't be read`); + throw new Error(`Artifact ${artifactPath} does not exist or can't be read`); } // Actually upload the file to upload endpoint. @@ -631,7 +631,7 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { const response = await this.uploadFileToMicrocks(uploadURI, artifactPath, "application/octet-stream"); if (response.status != 201) { - throw new Error("Artifact has not been correctly been imported: " + await response.json()); + throw new Error("Artifact has not been correctly imported: " + await response.text()); } } @@ -657,21 +657,21 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { }) if (response.status != 201) { - throw new Error("Artifact has not been correctly downloaded: " + await response.json()); + throw new Error("Artifact has not been correctly downloaded: " + await response.text()); } } private async importSnapshotInternal(snapshotPath: string): Promise { const isFile = await this.isFile(snapshotPath); if (!isFile) { - throw new Error(`Snapshot ${snapshotPath} does not exist or can't be read`); + throw new Error(`Snapshot ${snapshotPath} does not exist or can't be read`); } // Actually upload the file to upload endpoint. const response = await this.uploadFileToMicrocks(this.getHttpEndpoint() + "/api/import", snapshotPath, "application/json"); if (response.status != 201) { - throw new Error("Snapshot has not been correctly been imported: " + await response.json()); + throw new Error("Snapshot has not been correctly imported: " + await response.text()); } } @@ -762,8 +762,8 @@ export class StartedMicrocksContainer extends AbstractStartedContainer { } private formatDate(invocationDate: Date): string { - const month = invocationDate.getMonth() < 10 ? `0${invocationDate.getMonth()}` : `${invocationDate.getMonth()}` - const day = invocationDate.getDate() < 10 ? `0${invocationDate.getDate()}` : `${invocationDate.getDate()}`; + const month = (invocationDate.getMonth() + 1).toString().padStart(2, "0"); + const day = invocationDate.getDate().toString().padStart(2, "0"); return `${invocationDate.getFullYear()}${month}${day}`; } } \ No newline at end of file From 56f4044563995a06bc7d7443b75050c180c45ba6 Mon Sep 17 00:00:00 2001 From: DivyanshuVorrtex Date: Thu, 7 May 2026 08:30:19 +0000 Subject: [PATCH 2/2] chores Signed-off-by: DivyanshuVorrtex --- package-lock.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8b52e21..cbe2882 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2672,7 +2672,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.29.tgz", "integrity": "sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ==", "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -5985,7 +5984,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -6122,7 +6120,6 @@ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -6210,7 +6207,6 @@ "integrity": "sha512-4nVGliEpxmhCL8DslSAUdxlB6+SMrhB0a1v5ijlh1xB1nEPuy1mxaHxysVucLHuWryAxLWg6a5ei+U4TLn/rFg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -6327,7 +6323,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" },