Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtwist committed Nov 3, 2024
1 parent a93a9f9 commit 06a6565
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions modules/mock-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ export class MockServer {
return null;
}

private getExampleByFormat(format: string): any {
private getExampleByFormat(format: string): unknown {
switch (format) {
case "date-time":
return new Date().toISOString();
Expand All @@ -670,8 +670,8 @@ export class MockServer {
detail: string,
errors?: string[],
): Response {
const problemDetails: any = {
type: "about:blank",
const problemDetails: ProblemDetails = {
type: `https://httpproblems.com/http-status/${status}`,
title,
status,
detail,
Expand All @@ -685,3 +685,11 @@ export class MockServer {
});
}
}

interface ProblemDetails {
type: string;
title: string;
status: number;
detail: string;
errors?: string[];
}
2 changes: 1 addition & 1 deletion tests/mock-server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("MockServer Tests for Pizza API", () => {
assert.strictEqual(response.status, 400);
const responseBody = await response.json();
assert.deepStrictEqual(responseBody, {
type: "about:blank",
type: "https://httpproblems.com/http-status/400",
title: "Bad Request",
status: 400,
detail: "Invalid parameters",
Expand Down

0 comments on commit 06a6565

Please sign in to comment.