diff --git a/server/src/repositories/storage.repository.spec.ts b/server/src/repositories/storage.repository.spec.ts index e770ce6c1b..22a0ff8ddc 100644 --- a/server/src/repositories/storage.repository.spec.ts +++ b/server/src/repositories/storage.repository.spec.ts @@ -202,7 +202,7 @@ describe(StorageRepository.name, () => { .filter((entry) => entry[1]) .map(([file]) => file); - expect(actual.sort()).toEqual(expected.sort()); + expect(actual.toSorted()).toEqual(expected.toSorted()); }); } }); diff --git a/server/src/services/asset-media.service.spec.ts b/server/src/services/asset-media.service.spec.ts index bf545ff3b3..3990b4c3de 100644 --- a/server/src/services/asset-media.service.spec.ts +++ b/server/src/services/asset-media.service.spec.ts @@ -255,13 +255,11 @@ describe(AssetMediaService.name, () => { } it('should be sorted (valid)', () => { - // TODO: use toSorted in NodeJS 20. - expect(valid).toEqual([...valid].sort()); + expect(valid).toEqual(valid.toSorted()); }); it('should be sorted (invalid)', () => { - // TODO: use toSorted in NodeJS 20. - expect(invalid).toEqual([...invalid].sort()); + expect(invalid).toEqual(invalid.toSorted()); }); }); } diff --git a/server/src/utils/mime-types.spec.ts b/server/src/utils/mime-types.spec.ts index cbbf751bc5..996ea6c744 100644 --- a/server/src/utils/mime-types.spec.ts +++ b/server/src/utils/mime-types.spec.ts @@ -145,7 +145,7 @@ describe('mimeTypes', () => { it('should be a sorted list', () => { const keys = Object.keys(mimeTypes.video); - expect(keys).toEqual([...keys].sort()); + expect(keys).toEqual(keys.toSorted()); }); it('should contain only video mime types', () => { @@ -171,7 +171,7 @@ describe('mimeTypes', () => { it('should be a sorted list', () => { const keys = Object.keys(mimeTypes.sidecar); - expect(keys).toEqual([...keys].sort()); + expect(keys).toEqual(keys.toSorted()); }); it('should contain only xml mime types', () => { diff --git a/server/tsconfig.json b/server/tsconfig.json index 3e84bcf7d7..1ffc110e83 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -10,6 +10,7 @@ "resolveJsonModule": true, "target": "es2022", "moduleResolution": "node16", + "lib": ["dom", "es2023"], "sourceMap": true, "outDir": "./dist", "incremental": true,