diff --git a/packages/auth/src/infrastructure/repositories/mock-users.repository.ts b/packages/auth/src/infrastructure/repositories/mock-users.repository.ts new file mode 100644 index 0000000..4c4f194 --- /dev/null +++ b/packages/auth/src/infrastructure/repositories/mock-users.repository.ts @@ -0,0 +1,26 @@ +import "reflect-metadata"; +import { injectable } from "inversify"; + +import type { IUsersRepository } from "../../application/repositories/users-repository.interface"; +import type { User } from "../../entities/user"; + +@injectable() +export class MockUsersRepository implements IUsersRepository { + private _users: User[] = [ + { id: "1", username: "alice", passwordHash: "hashed_password_alice" }, + { id: "2", username: "bob", passwordHash: "hashed_password_bob" }, + ]; + + async getUser(id: string): Promise { + return this._users.find((u) => u.id === id); + } + + async getUserByUsername(username: string): Promise { + return this._users.find((u) => u.username === username); + } + + async createUser(input: User): Promise { + this._users.push(input); + return input; + } +}