Skip to content

Commit

Permalink
Hotfix: 327 building a type documentation has failed (#328)
Browse files Browse the repository at this point in the history
* fix: incorrect type definition

* fix: added an override setting on the typedoc

* fix: tests

* chore: removed an unused import

* fix: test
  • Loading branch information
hitohata authored Mar 20, 2024
1 parent 2ec76e4 commit 7b26f79
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 1 addition & 2 deletions backend/main/src/Group/Router/ContainerRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { honoResponseAdapter } from "src/Shared/Adapters/HonoAdapter";
import { CreateContainerUseCase } from "src/Group/UseCases/CreateContainerUseCase/CreateContainerUseCase";
import { CreateContainerController } from "src/Group/Controllers/CreateContainerController";
import {
honoNotImplementedAdapter,
honoBadRequestAdapter,
authHeader,
} from "src/Shared/Adapters/HonoAdapter";
Expand Down Expand Up @@ -268,7 +267,7 @@ const isCorrectFoodBody = (body: any): Result<IFoodDto, string> => {
name: body.name,
unit: body.unit,
quantity: body.quantity,
expiry: body.expiry ? new Date(body.expiry) : null,
expiry: body.expiry ? new Date(body.expiry) : undefined,
category: body.category,
});
};
Expand Down
2 changes: 1 addition & 1 deletion backend/main/src/User/Controllers/FindUserController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export class FindUserController extends Controller<

interface IFindUserData {
userId: string;
username: string;
name: string;
}
10 changes: 5 additions & 5 deletions backend/main/test/Group/Router/ContainerRouter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@ describe("isCorrectFoodBody", () => {

expect(result.ok).toBeTruthy();

const { value } = result;
const value = result.unwrap();
expect(value.name).toBe(body.name);
expect(value.unit).toBe(body.unit);
expect(value.category).toBe(body.category);
expect(value.quantity).toBe(body.quantity);
expect(value.expiry.toISOString()).toEqual(body.expiry);
expect(value.expiry?.toISOString()).toEqual(body.expiry);
});
it("unit can be null", () => {
body.unit = null;

const result = isCorrectFoodBody(body);

expect(result.ok).toBeTruthy();
expect(result.value.unit).toBeNull();
expect(result.unwrap().unit).toBeNull();
});
it("quantity can be null", () => {
body.quantity = null;

const result = isCorrectFoodBody(body);

expect(result.ok).toBeTruthy();
expect(result.value.quantity).toBeNull();
expect(result.unwrap().quantity).toBeNull();
});
it("expiry can be null", () => {
body.expiry = null;

const result = isCorrectFoodBody(body);

expect(result.ok).toBeTruthy();
expect(result.value.expiry).toBeNull();
expect(result.unwrap().expiry).toBeUndefined();
});
});

Expand Down
5 changes: 4 additions & 1 deletion backend/main/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"searchInComments": true,
"plugin": ["typedoc-theme-hierarchy"],
"tsconfig": "./tsconfig.json",
"name": "Nishiki Backend"
"name": "Nishiki Backend",
"compilerOptions": {
"noImplicitAny": false
}
}

0 comments on commit 7b26f79

Please # to comment.