Skip to content

Commit

Permalink
refactor(server): use .toSorted (#10904)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 authored Jul 6, 2024
1 parent 01706cc commit 59cdbdc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server/src/repositories/storage.repository.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
}
});
Expand Down
6 changes: 2 additions & 4 deletions server/src/services/asset-media.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions server/src/utils/mime-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand Down
1 change: 1 addition & 0 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"resolveJsonModule": true,
"target": "es2022",
"moduleResolution": "node16",
"lib": ["dom", "es2023"],
"sourceMap": true,
"outDir": "./dist",
"incremental": true,
Expand Down

0 comments on commit 59cdbdc

Please sign in to comment.