Skip to content

Commit

Permalink
fix: update schema with optionals
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansberg committed Sep 26, 2023
1 parent 82e0bff commit 1e87ca3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/page-modules/departures/__tests__/departure.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ describe('departure page', function () {
const initialProps: DeparturesPageProps = {
autocompleteFeatures: [
{
id: '1',
name: 'Result 1',
category: [],
layer: '',
locality: '',
},
{
id: '2',
name: 'Result 2',
category: [],
layer: '',
Expand All @@ -43,7 +45,7 @@ describe('departure page', function () {

it('Should return props from getServerSideProps', async () => {
const expectedResult = [
{ name: 'Test', category: [], layer: '', locality: '' },
{ id: 'Test ID', name: 'Test', category: [], layer: '', locality: '' },
];

const client: HttpClient<'entur', AutocompleteApi> = {
Expand Down
10 changes: 5 additions & 5 deletions src/page-modules/departures/server/autocomplete/encoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export const propertiesSchema = z.object({
name: z.string(),
street: z.string().optional(),
accuracy: z.string(),
country_a: z.string(),
county: z.string(),
county_gid: z.string(),
locality: z.string(),
locality_gid: z.string(),
country_a: z.string().optional(),
county: z.string().optional(),
county_gid: z.string().optional(),
locality: z.string().optional(),
locality_gid: z.string().optional(),
borough: z.string().optional(),
borough_gid: z.string().optional(),
label: z.string(),
Expand Down
2 changes: 1 addition & 1 deletion src/page-modules/departures/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FeatureCategory } from '@atb/components/venue-icon';
export type AutocompleteFeature = {
id: string;
name: string;
locality: string;
locality?: string;
category: FeatureCategory[];
layer: string;
};

0 comments on commit 1e87ca3

Please sign in to comment.