website refactor
This commit is contained in:
@@ -15,7 +15,7 @@ import { FeatureAvailabilityGuard } from '../policy/FeatureAvailabilityGuard';
|
||||
describe('League roster admin read (HTTP, league-scoped)', () => {
|
||||
const originalEnv = { ...process.env };
|
||||
|
||||
let app: any;
|
||||
let app: import("@nestjs/common").INestApplication;
|
||||
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
@@ -62,9 +62,9 @@ describe('League roster admin read (HTTP, league-scoped)', () => {
|
||||
};
|
||||
|
||||
app.useGlobalGuards(
|
||||
new AuthenticationGuard(sessionPort as any),
|
||||
new AuthorizationGuard(reflector, authorizationService as any),
|
||||
new FeatureAvailabilityGuard(reflector, policyService as any),
|
||||
new AuthenticationGuard(sessionPort as never),
|
||||
new AuthorizationGuard(reflector, authorizationService as never),
|
||||
new FeatureAvailabilityGuard(reflector, policyService as never),
|
||||
);
|
||||
|
||||
await app.init();
|
||||
@@ -105,7 +105,7 @@ describe('League roster admin read (HTTP, league-scoped)', () => {
|
||||
expect(res.body).toEqual(expect.any(Array));
|
||||
expect(res.body.length).toBeGreaterThan(0);
|
||||
|
||||
const first = res.body[0] as any;
|
||||
const first = res.body[0] as unknown as { driver: { id: string, name: string, country: string }, role: string };
|
||||
expect(first).toMatchObject({
|
||||
driverId: expect.any(String),
|
||||
role: expect.any(String),
|
||||
@@ -133,8 +133,8 @@ describe('League roster admin read (HTTP, league-scoped)', () => {
|
||||
|
||||
// Seed data may or may not include join requests for a given league.
|
||||
// Validate shape on first item if present.
|
||||
if ((res.body as any[]).length > 0) {
|
||||
const first = (res.body as any[])[0];
|
||||
if ((res.body as never[]).length > 0) {
|
||||
const first = (res.body as unknown as { message?: string }[])[0];
|
||||
expect(first).toMatchObject({
|
||||
id: expect.any(String),
|
||||
leagueId: expect.any(String),
|
||||
@@ -146,8 +146,10 @@ describe('League roster admin read (HTTP, league-scoped)', () => {
|
||||
},
|
||||
});
|
||||
|
||||
if (first.message !== undefined) {
|
||||
expect(first.message).toEqual(expect.any(String));
|
||||
if (first) {
|
||||
if (first.message !== undefined) {
|
||||
expect(first.message).toEqual(expect.any(String));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user