Skip to content

Commit

Permalink
Fix issue in integration tests where assuming the number of collectio…
Browse files Browse the repository at this point in the history
…ns in a request threw an error in the server
  • Loading branch information
jonathonherbert committed Apr 26, 2024
1 parent 6c132f1 commit 94d55e4
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions fronts-client/integration/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,20 @@ module.exports = async () =>
app.get('/editions-api/collections/:id/prefill', (req, res) => {
return res.json(prefill);
});

app.post('/editions-api/collections', (req, res) => {
return res.json([
{
id: req.body[0].id,
collection: {
...collection,
items: collection.draft
}
},
{
id: req.body[1].id,
const collectionStubs = [collection, collectionTwo];

// Expects a body of `{ id: string }[]`
return res.json(
req.body.map(({ id }, index) => ({
id,
collection: {
...collectionTwo,
items: collectionTwo.draft
}
}
]);
...collectionStubs[index],
items: collectionStubs[index].draft,
},
}))
);
});

// catch requests to discard collection endpoint
Expand Down

0 comments on commit 94d55e4

Please sign in to comment.