Skip to content

Commit

Permalink
Use stricter type for os
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn committed Apr 23, 2024
1 parent 9b3b7c0 commit c6be498
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/frontend/metrics/generateMetricsReport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ describe('generateMetricsReport', () => {
});

it('includes the OS (iOS style)', () => {
const options = {...defaultOptions, os: 'ios', osVersion: '1.2.3'};
const options = {...defaultOptions, os: 'ios' as const, osVersion: '1.2.3'};
const report = generateMetricsReport(options);
expect(report.os).toBe('ios');
expect(report.osVersion).toBe('1.2.3');
});

it('includes the OS (desktop style)', () => {
const options = {...defaultOptions, os: 'win32', osVersion: '1.2.3'};
const options = {
...defaultOptions,
os: 'win32' as const,
osVersion: '1.2.3',
};
const report = generateMetricsReport(options);
expect(report.os).toBe('win32');
expect(report.osVersion).toBe('1.2.3');
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/metrics/generateMetricsReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function generateMetricsReport({
observations,
}: ReadonlyDeep<{
packageJson: {version: string};
os: string;
os: 'android' | 'ios' | NodeJS.Platform;
osVersion: number | string;
screen: {width: number; height: number};
observations: ReadonlyArray<Pick<Observation, 'lat' | 'lon'>>;
Expand Down

0 comments on commit c6be498

Please sign in to comment.