Files
Immich/server/test/factories/oauth-profile.factory.ts
T
Daniel DietzlerandCodex f2e05e9d98 chore: migrate oauth claim validation to zod (#32373)
(cherry picked from commit 0808f24a37cf376a509f1b4046cd52fd2d72b20d)
2026-10-29 20:43:01 +03:00

29 lines
716 B
TypeScript

import { OAuthRawProfile } from 'src/repositories/oauth.repository.js';
import { OAuthProfileLike } from 'test/factories/types.js';
import { newUuid } from 'test/small.factory.js';
export class OAuthProfileFactory {
private constructor(private value: OAuthRawProfile) {}
static create(dto: OAuthProfileLike = {}) {
return OAuthProfileFactory.from(dto).build();
}
static from(dto: OAuthProfileLike = {}) {
const sub = newUuid();
return new OAuthProfileFactory({
sub,
name: 'Name',
given_name: 'Given',
family_name: 'Family',
email: `oauth-${sub}@immich.cloud`,
email_verified: true,
...dto,
});
}
build() {
return { ...this.value };
}
}