Fix camera test

This commit is contained in:
Sam Becker 2025-03-21 18:51:47 -05:00
parent 13cb8099f5
commit d6fe11f2e2
2 changed files with 3 additions and 4 deletions

View File

@ -12,7 +12,7 @@ const RICOH : Camera = {
model: 'RICOH GR III',
};
export const SONY_CAMERAS = {
export const SONY_MODELS = {
'ILCE-1M2': 'A1 II',
'ILCE-1': 'A1',
'ILCE-9M3': 'A9 III',
@ -75,10 +75,10 @@ describe('Camera', () => {
expect(formatCameraText(NIKON, 'short')).toBe('D7000');
});
it('formats Sony cameras', () => {
Object.entries(SONY_CAMERAS).forEach(([model, expected]) => {
Object.entries(SONY_MODELS).forEach(([model, expected]) => {
const camera = { make: MAKE_SONY, model };
expect(formatCameraText(camera, 'medium'))
.toBe(expected.toLocaleUpperCase());
.toBe(`${MAKE_SONY} ${expected}`.toLocaleUpperCase());
});
});
});

View File

@ -13,7 +13,6 @@ export const formatSonyModel = (model: string) => {
letter,
version,
modifier,
// eslint-disable-next-line max-len
] = /^(ILCE|ILME)-([0-9]*)([a-ln-z]*)M*([0-9]*)([a-z]*)/gi.exec(model) ?? [];
const versionNumber = parseInt(version || '0');
const versionRomanNumeral = versionNumber > 1 && versionNumber < 10