mirror of
https://github.com/immich-app/immich.git
synced 2026-02-09 11:20:00 +03:00
* refactor(server): calculate asset type server-side
* chore: open api
* chore: remove comments
* fix: linting
* update
* Revert "update"
This reverts commit dc58702923.
* fix: upload LivePhotos
* chore: remove unused request fields for upload
* remove unused method
* mobile-fix: livePhoto filename
* fix: revert check for livephotos filename and extension
---------
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
36 lines
876 B
TypeScript
36 lines
876 B
TypeScript
import { UploadService } from './upload.service';
|
|
import mockfs from 'mock-fs';
|
|
import axios from 'axios';
|
|
import mockAxios from 'jest-mock-axios';
|
|
import FormData from 'form-data';
|
|
import { ApiConfiguration } from '../cores/api-configuration';
|
|
|
|
describe('UploadService', () => {
|
|
let uploadService: UploadService;
|
|
|
|
beforeAll(() => {
|
|
// Write a dummy output before mock-fs to prevent some annoying errors
|
|
console.log();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
const apiConfiguration = new ApiConfiguration('https://example.com/api', 'key');
|
|
|
|
uploadService = new UploadService(apiConfiguration);
|
|
});
|
|
|
|
it('should upload a single file', async () => {
|
|
const data = new FormData();
|
|
|
|
uploadService.upload(data);
|
|
|
|
mockAxios.mockResponse();
|
|
expect(axios).toHaveBeenCalled();
|
|
});
|
|
|
|
afterEach(() => {
|
|
mockfs.restore();
|
|
mockAxios.reset();
|
|
});
|
|
});
|