Support iPhone lenses without makes
This commit is contained in:
parent
8423f3e4fb
commit
47a53a2398
@ -5,6 +5,9 @@ const IPHONE_15_PRO_FRONT: Lens = { make: 'Apple', model: 'iPhone 15 Pro front T
|
|||||||
const IPHONE_15_PRO_BACK_WIDE: Lens = { make: 'Apple', model: 'iPhone 15 Pro back triple camera 6.765mm f/2.2' };
|
const IPHONE_15_PRO_BACK_WIDE: Lens = { make: 'Apple', model: 'iPhone 15 Pro back triple camera 6.765mm f/2.2' };
|
||||||
const IPHONE_15_PRO_BACK_MAIN: Lens = { make: 'Apple', model: 'iPhone 15 Pro back triple camera 6.765mm f/1.78' };
|
const IPHONE_15_PRO_BACK_MAIN: Lens = { make: 'Apple', model: 'iPhone 15 Pro back triple camera 6.765mm f/1.78' };
|
||||||
const IPHONE_15_PRO_BACK_TELEPHOTO: Lens = { make: 'Apple', model: 'iPhone 15 Pro back triple camera 6.765mm f/2.8' };
|
const IPHONE_15_PRO_BACK_TELEPHOTO: Lens = { make: 'Apple', model: 'iPhone 15 Pro back triple camera 6.765mm f/2.8' };
|
||||||
|
const IPHONE_14_PRO_BACK_WIDE_NO_MAKE: Lens = { model: 'iPhone 14 Pro back dual wide camera 6.86mm f/1.78' };
|
||||||
|
const IPHONE_12_PRO_MAX_BACK_WIDE_NO_MAKE: Lens = { model: 'iPhone 12 Pro Max back dual camera 7.5mm f/2.2' };
|
||||||
|
const IPHONE_12_PRO_MAX_BACK_TELEPHOTO_NO_MAKE: Lens = { model: 'iPhone 12 Pro Max back triple camera 5.1mm f/1.6' };
|
||||||
|
|
||||||
const PIXEL_8_PRO_BACK: Lens = { make: 'Google', model: 'Pixel 8 Pro back camera 6.9mm f/1.68' };
|
const PIXEL_8_PRO_BACK: Lens = { make: 'Google', model: 'Pixel 8 Pro back camera 6.9mm f/1.68' };
|
||||||
const PIXEL_8_PRO_BACK_NO_MAKE: Lens = { model: 'Pixel 8 Pro back camera 6.9mm f/1.68' };
|
const PIXEL_8_PRO_BACK_NO_MAKE: Lens = { model: 'Pixel 8 Pro back camera 6.9mm f/1.68' };
|
||||||
@ -17,6 +20,9 @@ describe('Lens', () => {
|
|||||||
expect(formatLensText(IPHONE_15_PRO_BACK_WIDE)).toBe('15 Pro Wide (6.765mm)');
|
expect(formatLensText(IPHONE_15_PRO_BACK_WIDE)).toBe('15 Pro Wide (6.765mm)');
|
||||||
expect(formatLensText(IPHONE_15_PRO_BACK_MAIN)).toBe('15 Pro Main (6.765mm)');
|
expect(formatLensText(IPHONE_15_PRO_BACK_MAIN)).toBe('15 Pro Main (6.765mm)');
|
||||||
expect(formatLensText(IPHONE_15_PRO_BACK_TELEPHOTO)).toBe('15 Pro Telephoto (6.765mm)');
|
expect(formatLensText(IPHONE_15_PRO_BACK_TELEPHOTO)).toBe('15 Pro Telephoto (6.765mm)');
|
||||||
|
expect(formatLensText(IPHONE_14_PRO_BACK_WIDE_NO_MAKE)).toBe('14 Pro Main (6.86mm)');
|
||||||
|
expect(formatLensText(IPHONE_12_PRO_MAX_BACK_WIDE_NO_MAKE)).toBe('12 Pro Max Telephoto (7.5mm)');
|
||||||
|
expect(formatLensText(IPHONE_12_PRO_MAX_BACK_TELEPHOTO_NO_MAKE)).toBe('12 Pro Max Main (5.1mm)');
|
||||||
});
|
});
|
||||||
it('Pixel lenses', () => {
|
it('Pixel lenses', () => {
|
||||||
expect(formatLensText(PIXEL_8_PRO_BACK, 'medium')).toBe('Pixel 8 Pro Back Camera (6.9mm)');
|
expect(formatLensText(PIXEL_8_PRO_BACK, 'medium')).toBe('Pixel 8 Pro Back Camera (6.9mm)');
|
||||||
|
|||||||
@ -12,8 +12,9 @@ export const isCameraApple = ({ make }: Camera) =>
|
|||||||
export const isLensMakeApple = (make?: string) =>
|
export const isLensMakeApple = (make?: string) =>
|
||||||
make?.toLocaleLowerCase() === MAKE_APPLE;
|
make?.toLocaleLowerCase() === MAKE_APPLE;
|
||||||
|
|
||||||
export const isLensApple = ({ make }: Lens) =>
|
export const isLensApple = ({ make, model }: Lens) =>
|
||||||
isLensMakeApple(make);
|
isLensMakeApple(make) ||
|
||||||
|
/^iPhone [0-9a-z]{1,3}/i.test(model);
|
||||||
|
|
||||||
export const formatAppleLensText = (
|
export const formatAppleLensText = (
|
||||||
model: string,
|
model: string,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user