integration tests
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m50s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m50s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { MediaTestContext } from '../MediaTestContext';
|
||||
|
||||
describe('Category Icon Management', () => {
|
||||
let ctx: MediaTestContext;
|
||||
|
||||
beforeEach(() => {
|
||||
ctx = MediaTestContext.create();
|
||||
ctx.reset();
|
||||
});
|
||||
|
||||
it('should upload and retrieve a category icon', async () => {
|
||||
// When: An icon is uploaded
|
||||
const uploadResult = await ctx.mediaStorage.uploadMedia(
|
||||
Buffer.from('icon content'),
|
||||
{ filename: 'icon.png', mimeType: 'image/png' }
|
||||
);
|
||||
expect(uploadResult.success).toBe(true);
|
||||
const storageKey = uploadResult.url!;
|
||||
|
||||
// Then: The icon should be retrievable from storage
|
||||
const retrieved = await ctx.getUploadedMediaUseCase.execute({ storageKey });
|
||||
expect(retrieved.isOk()).toBe(true);
|
||||
expect(retrieved.unwrap()?.contentType).toBe('image/png');
|
||||
});
|
||||
|
||||
it('should handle multiple category icons', async () => {
|
||||
const upload1 = await ctx.mediaStorage.uploadMedia(
|
||||
Buffer.from('icon 1'),
|
||||
{ filename: 'icon1.png', mimeType: 'image/png' }
|
||||
);
|
||||
const upload2 = await ctx.mediaStorage.uploadMedia(
|
||||
Buffer.from('icon 2'),
|
||||
{ filename: 'icon2.png', mimeType: 'image/png' }
|
||||
);
|
||||
|
||||
expect(upload1.success).toBe(true);
|
||||
expect(upload2.success).toBe(true);
|
||||
expect(ctx.mediaStorage.size).toBe(2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user