fix(server,cli): don't float promises (#4433)

* fix: don't allow floating promises

* fix: await all promises

* fix: download archives

* fix cli tests

* fix: skip web
This commit is contained in:
Jonathan Jogenfors
2023-10-13 07:22:40 +02:00
committed by GitHub
parent 7e9fc4aa97
commit f0bb50b61a
13 changed files with 41 additions and 43 deletions

View File

@@ -272,7 +272,7 @@ export class AssetService {
zip.addFile(originalPath, filename);
}
zip.finalize();
void zip.finalize();
return { stream: zip.stream };
}

View File

@@ -267,9 +267,9 @@ describe(SearchService.name, () => {
});
describe('handleIndexAlbums', () => {
it('should skip if search is disabled', () => {
it('should skip if search is disabled', async () => {
sut['enabled'] = false;
sut.handleIndexAlbums();
await sut.handleIndexAlbums();
});
it('should index all the albums', async () => {
@@ -355,18 +355,18 @@ describe(SearchService.name, () => {
});
describe('handleIndexAsset', () => {
it('should skip if search is disabled', () => {
it('should skip if search is disabled', async () => {
sut['enabled'] = false;
sut.handleIndexFace({ assetId: 'asset-1', personId: 'person-1' });
await sut.handleIndexFace({ assetId: 'asset-1', personId: 'person-1' });
expect(searchMock.importFaces).not.toHaveBeenCalled();
expect(personMock.getFacesByIds).not.toHaveBeenCalled();
});
it('should index the face', () => {
it('should index the face', async () => {
personMock.getFacesByIds.mockResolvedValue([faceStub.face1]);
sut.handleIndexFace({ assetId: 'asset-1', personId: 'person-1' });
await sut.handleIndexFace({ assetId: 'asset-1', personId: 'person-1' });
expect(personMock.getFacesByIds).toHaveBeenCalledWith([{ assetId: 'asset-1', personId: 'person-1' }]);
});