Introduces a shared CSS custom property token layer and applies it across all five views (library, upload, detail, login, app shell). Each view now has intentional loading, empty, and error states. - styles.css: 13 design tokens on :root; shimmer skeleton animation - Library: 150ms-debounced skeleton loading, empty state with /upload link, error card with retry, card hover lift, broken-image fallback - Upload: token-styled drop-zone, Uploading… spinner, 4s success banner, distinct validation vs. network error messages - Detail: image skeleton, network error card (separate from 404 not-found card), Owner actions panel, danger tag error styling, broken-image fallback - Login: vertically centred surface card, danger field/server errors, Signing in… disabled button - App shell: 48px fixed header, app name left, sign-out right, no reflow on auth state change - All 24 ESLint errors resolved (including pre-existing auth spec issues); ng build and ng lint pass clean Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { TestBed } from '@angular/core/testing';
|
|
import { provideRouter, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
|
|
import { provideLocationMocks } from '@angular/common/testing';
|
|
import { authGuard } from './auth.guard';
|
|
import { AuthService } from './auth.service';
|
|
|
|
describe('authGuard', () => {
|
|
let authService: jasmine.SpyObj<AuthService>;
|
|
|
|
beforeEach(() => {
|
|
authService = jasmine.createSpyObj('AuthService', ['isAuthenticated']);
|
|
|
|
TestBed.configureTestingModule({
|
|
providers: [
|
|
provideRouter([]),
|
|
provideLocationMocks(),
|
|
{ provide: AuthService, useValue: authService },
|
|
],
|
|
});
|
|
});
|
|
|
|
it('redirects to login when not authenticated', () => {
|
|
authService.isAuthenticated.and.returnValue(false);
|
|
const route = {} as ActivatedRouteSnapshot;
|
|
const state = { url: '/upload' } as RouterStateSnapshot;
|
|
const result = TestBed.runInInjectionContext(() => authGuard(route, state));
|
|
expect(result).toBeTruthy();
|
|
const urlTree = result as ReturnType<Router['createUrlTree']>;
|
|
expect(urlTree.toString()).toContain('/login');
|
|
});
|
|
});
|