Skip to content

Commit

Permalink
Give null when no data instead of empty object
Browse files Browse the repository at this point in the history
  • Loading branch information
RoanPaulus committed Dec 19, 2024
1 parent 946b610 commit 63810c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/services/bag.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ describe('BAG service', () => {
test('No data in response', async () => {
setupNockResponse(200, {});
const response = await fetchBAG(REQUEST_ID, ADDRESS);
expect(response).toStrictEqual({ status: 'OK', content: {} });
expect(response).toStrictEqual({ status: 'OK', content: null });
});
});
2 changes: 1 addition & 1 deletion src/server/services/bag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function fetchBAG(
transformResponse: (responseData) => {
const data = responseData._embedded?.adresseerbareobjecten;
if (!data || data.length < 1) {
return {};
return null;
}

// Multiple items can be found, but only the first we take as relevant.
Expand Down

0 comments on commit 63810c4

Please sign in to comment.