Skip to content

Commit

Permalink
fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadkitenge committed Apr 24, 2024
1 parent 4c6b7ea commit 81dd656
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
MONGO_INITDB_ROOT_PASSWORD: example

ims-api:
image: harbor.stfc.ac.uk/inventory-management-system/ims-api:develop
image: harbor.stfc.ac.uk/inventory-management-system/ims-api:pr-240
ports:
- 8000:8000
env:
Expand Down
17 changes: 13 additions & 4 deletions src/api/catalogueItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,25 @@ export const useCopyToCatalogueItem = (): UseMutationResult<
// Information to post (backend will just ignore the extra here - only id and code)
// Also use Object.assign to copy the data otherwise will modify in place causing issues
// in tests

const targetProperties =
copyToCatalogueItem.targetCatalogueCategory
?.catalogue_item_properties;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const properties = catalogueItem.properties.map(
({ name, unit, ...rest }) => rest
);
const properties = catalogueItem.properties.map((property) => {
const targetPropertyId = targetProperties?.find(
(targetProperty) => property.name === targetProperty.name
)?.id;
return { id: targetPropertyId, value: property.value };
});

const catalogueItemAdd: AddCatalogueItem = Object.assign(
{},
{ ...catalogueItem, properties: properties }
) as AddCatalogueItem;

// Assing new parent
// Assign new parent
catalogueItemAdd.catalogue_category_id =
copyToCatalogueItem.targetCatalogueCategory?.id ?? '';

Expand Down

0 comments on commit 81dd656

Please sign in to comment.