[Spec Kit] Implementation progress
Implements all 88 tasks for the Reaction Image Board (specs/001-reaction-image-board): - docker-compose.yml: postgres, minio, minio-init, api, ui services with healthchecks - api/: FastAPI app with SQLAlchemy 2.x async, Alembic migrations, S3/MinIO storage, full integration + unit test suite (pytest + pytest-asyncio) - ui/: Angular 19 standalone app (Library, Upload, Detail, NotFound components) - .env.example: all required environment variables - .gitignore: Python, Node, Docker, IDE, .env patterns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
49
ui/src/app/library/library.component.spec.ts
Normal file
49
ui/src/app/library/library.component.spec.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { LibraryComponent } from './library.component';
|
||||
import { ImageService } from '../services/image.service';
|
||||
import { routes } from '../app.routes';
|
||||
|
||||
describe('LibraryComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [LibraryComponent],
|
||||
providers: [provideHttpClient(), provideHttpClientTesting(), provideRouter(routes)],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should render image grid from service response', () => {
|
||||
const fixture = TestBed.createComponent(LibraryComponent);
|
||||
const component = fixture.componentInstance;
|
||||
const imgSvc = TestBed.inject(ImageService);
|
||||
spyOn(imgSvc, 'list').and.returnValue(
|
||||
of({
|
||||
items: [
|
||||
{ id: '1', filename: 'a.jpg', tags: ['cat'], hash: '', mime_type: 'image/jpeg', size_bytes: 1, width: 1, height: 1, storage_key: '', created_at: '' },
|
||||
],
|
||||
total: 1,
|
||||
limit: 50,
|
||||
offset: 0,
|
||||
})
|
||||
);
|
||||
fixture.detectChanges();
|
||||
const de = fixture.nativeElement as HTMLElement;
|
||||
expect(de.querySelectorAll('.image-card').length).toBe(1);
|
||||
});
|
||||
|
||||
it('should trigger new API call with tags param on filter change', () => {
|
||||
const fixture = TestBed.createComponent(LibraryComponent);
|
||||
const component = fixture.componentInstance;
|
||||
const imgSvc = TestBed.inject(ImageService);
|
||||
const listSpy = spyOn(imgSvc, 'list').and.returnValue(
|
||||
of({ items: [], total: 0, limit: 50, offset: 0 })
|
||||
);
|
||||
fixture.detectChanges();
|
||||
|
||||
component.applyFilter(['cat', 'funny']);
|
||||
expect(listSpy).toHaveBeenCalledWith(['cat', 'funny'], jasmine.any(Number), jasmine.any(Number));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user