Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Aug 27, 2024
1 parent e46a0db commit 16299ba
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions packages/cma-client-node/__tests__/uploadCollection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,39 @@ describe('upload collection', () => {
it.concurrent('create, find, list, update, destroy', async () => {
const client = await generateNewCmaClient();

const menuItem = await client.menuItems.create({
const menuItem = await client.uploadCollections.create({
label: 'Browse Articles',
position: 1,
});

expect(menuItem.label).toEqual('Browse Articles');

const foundMenuItems = await client.menuItems.find(menuItem);
expect(foundMenuItems.id).toEqual(menuItem.id);
const foundUploadCollections =
await client.uploadCollections.find(menuItem);
expect(foundUploadCollections.id).toEqual(menuItem.id);

const allMenuItems = await client.menuItems.list();
expect(allMenuItems).toHaveLength(1);
const allUploadCollections = await client.uploadCollections.list();
expect(allUploadCollections).toHaveLength(1);

const updatedMenuItems = await client.menuItems.update(menuItem, {
...menuItem,
label: 'Updated',
});
expect(updatedMenuItems.label).toEqual('Updated');
const updatedUploadCollections = await client.uploadCollections.update(
menuItem,
{
...menuItem,
label: 'Updated',
},
);
expect(updatedUploadCollections.label).toEqual('Updated');

await client.menuItems.destroy(menuItem);
expect(await client.menuItems.list()).toHaveLength(0);
await client.uploadCollections.destroy(menuItem);
expect(await client.uploadCollections.list()).toHaveLength(0);
});

it.concurrent('create with explicit ID', async () => {
const client = await generateNewCmaClient();

const newId = generateId();

const menuItem = await client.menuItems.create({
const menuItem = await client.uploadCollections.create({
id: newId,
label: 'Browse Articles',
position: 1,
Expand Down

0 comments on commit 16299ba

Please sign in to comment.