immich icon indicating copy to clipboard operation
immich copied to clipboard

chore(server): fix ups for comments on #2945

Open elliotclee opened this issue 1 year ago • 2 comments

Sorry for the extra hassle - this PR consists solely of changes that should have been in #2945 but which I didn't push to the right place in time. It just sorts the list of raw mime types and removes a large comment that is unnecessary. Thanks to @uhthomas for noticing.

elliotclee avatar Jun 25 '23 20:06 elliotclee

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
immich ⬜️ Ignored (Inspect) Jun 26, 2023 7:53pm

vercel[bot] avatar Jun 25 '23 20:06 vercel[bot]

Looks great @elliotclee, thanks! As @jrasm91 suggested, a test which verifies the order of this list would be much appreciated.

uhthomas avatar Jun 25 '23 21:06 uhthomas

Can we add a jest test that asserts the mime type order is sorted?

I don't know how to write this type of test. If you point me to an example in immich I should be able to put together the logic OK. It will be a few days in any case - my electricity is getting disconnected tomorrow to allow for repairs.

elliotclee avatar Jun 26 '23 19:06 elliotclee

Can we add a jest test that asserts the mime type order is sorted?

I don't know how to write this type of test. If you point me to an example in immich I should be able to put together the logic OK. It will be a few days in any case - my electricity is getting disconnected tomorrow to allow for repairs.

Add something like this in asset-upload.config.spec.ts. You will need to export const validMimeTypes so it can be used in the test though.

// domain.constant.ts
export const validMimeTypes = [...]

// asset-upload.config.spec.ts
it('should be a sorted list', () => {
  expect(validMimeTypes).toEqual([...validMimeTypes].sort());
});

jrasm91 avatar Jun 26 '23 20:06 jrasm91

On a related note, it might be good to add a few other checks like:

  • there are no duplicates in the list
  • They all start with image/* or video/*
  • The values are all lower case

jrasm91 avatar Jun 26 '23 21:06 jrasm91

I've added the tests in #3001.

uhthomas avatar Jun 28 '23 09:06 uhthomas

superseded by #3001

alextran1502 avatar Jun 28 '23 14:06 alextran1502