Skip to content

Commit

Permalink
fix (scanner): add other video game platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhykos committed Oct 20, 2024
1 parent c433739 commit 0a0bab1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/scanner/domain/valueobject/VideoGamePlatform.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import { DomainError } from "../../../common/domain/DomainError.ts";
import type { ValueObject } from "../../../common/domain/ValueObject.ts";

const platforms = ["Nintendo Switch", "PC"];
const platforms = [
"Android",
"iOS",
"Nintendo Switch",
"PC",
"PlayStation 4",
"PlayStation 5",
"Steam Deck",
"Xbox 360",
"Xbox Game Cloud",
"Xbox One",
"Xbox Series X",
];

export class VideoGamePlatform implements ValueObject {
public constructor(public readonly value: string) {
Expand All @@ -11,7 +23,7 @@ export class VideoGamePlatform implements ValueObject {
public validateObjectProperties(): void {
if (!platforms.includes(this.value)) {
throw new DomainError(
`Platform (${this.value}) must be one of the following: ${platforms.join(", ")}`,
`Platform (${this.value}) must be one of the following: ${platforms.sort().join(", ")}`,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/scanner/domain/valueobject/VideoGamePlatform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Deno.test(function wrongPlatform() {
assert(error instanceof DomainError);
assertEquals(
error.message,
"Platform (foo) must be one of the following: Nintendo Switch, PC",
"Platform (foo) must be one of the following: Android, Nintendo Switch, PC, PlayStation 4, PlayStation 5, Steam Deck, Xbox 360, Xbox Game Cloud, Xbox One, Xbox Series X, iOS",
);
});

Expand Down

0 comments on commit 0a0bab1

Please sign in to comment.