Files
immich/server/src/microservices/utils/exif/iso.spec.ts
Jason Rasmussen 8ebac41318 refactor(server)*: tsconfigs (#2689)
* refactor(server): tsconfigs

* chore: dummy commit

* fix: start.sh

* chore: restore original entry scripts
2023-06-08 10:01:07 -05:00

25 lines
816 B
TypeScript

import { describe, it, expect } from '@jest/globals';
import { parseISO } from './iso';
describe('parsing ISO values', () => {
it('returns null for invalid values', () => {
expect(parseISO('')).toBeNull();
expect(parseISO(',,,')).toBeNull();
expect(parseISO('invalid')).toBeNull();
expect(parseISO('-5')).toBeNull();
expect(parseISO('99999999999999')).toBeNull();
});
it('returns the ISO number for valid inputs', () => {
expect(parseISO('0.0')).toBe(0);
expect(parseISO('32000.9')).toBe(32000);
});
it('returns the first valid ISO number in a comma separated list', () => {
expect(parseISO('400, 200, 100')).toBe(400);
expect(parseISO('-1600,800')).toBe(800);
expect(parseISO('-1, a., 1200')).toBe(1200);
expect(parseISO('NaN,50,100')).toBe(50);
});
});