MME-8 Prepare image-select.spec for use.

This commit is contained in:
Jesse Brault 2026-02-07 21:28:40 -06:00
parent 8c0a4dd9f4
commit 64b3cf92f7

View File

@ -1,14 +1,36 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ImageSelect } from './image-select'; import { ImageSelect } from './image-select';
import { Mocked } from 'vitest';
import { ImageService } from '../../../../../shared/services/ImageService';
import { of } from 'rxjs';
import { SliceView, SliceViewMeta } from '../../../../../shared/models/SliceView.model';
import { ImageViewWithBlobUrl } from '../../../../../shared/client-models/ImageViewWithBlobUrl';
describe('ImageSelect', () => { describe('ImageSelect', () => {
let component: ImageSelect; let component: ImageSelect;
let fixture: ComponentFixture<ImageSelect>; let fixture: ComponentFixture<ImageSelect>;
let imageService: Partial<Mocked<ImageService>> = {
getOwnedImageViewsWithBlobUrls: vi.fn(() =>
of({
content: [],
slice: {} as SliceViewMeta,
count: 0,
} as SliceView<ImageViewWithBlobUrl>),
),
getOwnedImagesCount: vi.fn(() => of(0)),
deleteImage: vi.fn(() => of()),
};
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [ImageSelect], imports: [ImageSelect],
providers: [
{
provide: ImageService,
useValue: imageService,
},
],
}).compileComponents(); }).compileComponents();
fixture = TestBed.createComponent(ImageSelect); fixture = TestBed.createComponent(ImageSelect);