Skip to content

Commit

Permalink
[eas-cli] Display creation date
Browse files Browse the repository at this point in the history
Added creation date to the AppleDevice formatting function used to display details in cli

See: https://linear.app/expo/issue/ENG-10334/show-creation-time-of-device-record-in-ad-hoc-device-selection-prompt
  • Loading branch information
radoslawkrzemien committed Oct 16, 2023
1 parent 606ce9a commit 41c039c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function formatDeviceLabel(device: AppleDeviceFragment): string {
const deviceDetails = formatDeviceDetails(device);
return `${device.identifier}${deviceDetails !== '' ? ` ${deviceDetails}` : ''}${
device.name ? ` (${device.name})` : ''
}`;
}${device.createdAt ? ` (created at: ${device.createdAt})` : ''}`;
}

function formatDeviceDetails(device: AppleDeviceFragment): string {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { v4 as uuidv4 } from 'uuid';

import { AppleDeviceClass, AppleDeviceFragment } from '../../../../graphql/generated';
import { formatDeviceLabel } from '../DeviceUtils';

describe(formatDeviceLabel, () => {
it('returns createdAt clause', async () => {
const currentDate = new Date();
const appleDevice = {
__typename: 'AppleDevice',
id: uuidv4(),
identifier: 'test-apple-device-id',
name: 'test-apple-device-name',
model: '15',
deviceClass: AppleDeviceClass.Iphone,
createdAt: currentDate.toISOString(),
} as AppleDeviceFragment;

const result = formatDeviceLabel(appleDevice);

expect(result).toEqual(
`test-apple-device-id (iPhone 15) (test-apple-device-name) (created at: ${currentDate.toISOString()})`
);
});
});

0 comments on commit 41c039c

Please sign in to comment.