Skip to content

Commit

Permalink
test(Inventory and Inventory type)
Browse files Browse the repository at this point in the history
- Complete integration test
- And constaint in form of inventory creation, allow reference number,
  manufacturer brand and manufacturer model only of Asset
  • Loading branch information
lomamech committed Feb 14, 2022
1 parent 769f6be commit a8a228a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/modules/inventory/list/modals/actions.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</label>
</div>

<div class="form-group"
<div ng-if="$ctrl.item.is_asset" class="form-group"
ng-class="{ 'has-error' : ActionForm.$submitted && ActionForm.external_reference_number.$invalid }">
<label class="control-label" translate>FORM.LABELS.REFERENCE_NUMBER</label>
<input
Expand All @@ -66,7 +66,7 @@
</div>
</div>

<div class="form-group"
<div ng-if="$ctrl.item.is_asset" class="form-group"
ng-class="{ 'has-error' : ActionForm.$submitted && ActionForm.manufacturer_brand.$invalid }">
<label class="control-label" translate>FORM.LABELS.MANUFACTURER_BRAND</label>
<input
Expand All @@ -81,7 +81,7 @@
</div>
</div>

<div class="form-group"
<div ng-if="$ctrl.item.is_asset" class="form-group"
ng-class="{ 'has-error' : ActionForm.$submitted && ActionForm.manufacturer_model.$invalid }">
<label class="control-label" translate>FORM.LABELS.MANUFACTURER_MODEL</label>
<input
Expand Down
8 changes: 8 additions & 0 deletions test/integration/inventory/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ describe('(/inventory/metadata) The inventory metadata http API', () => {
consumable : 0,
sellable : 1,
importance : 2,
is_asset : 1,
external_reference_number : 'BHIMA_O1',
manufacturer_brand : 'BHIMA',
manufacturer_model : '2.X',
};

const inventoryUuid = 'f6556e72-9d05-4799-8cbd-0a03b1810185';
Expand All @@ -29,6 +33,8 @@ describe('(/inventory/metadata) The inventory metadata http API', () => {
default_quantity : 12,
group_uuid : shared.inventoryGroup.uuid,
consumable : 0,
manufacturer_brand : 'HTML',
manufacturer_model : '2.',
};

const metadataSearch = {
Expand Down Expand Up @@ -66,6 +72,8 @@ describe('(/inventory/metadata) The inventory metadata http API', () => {
expect(res.body.default_quantity).to.be.equal(metadataUpdate.default_quantity);
expect(res.body.group_uuid).to.be.equal(metadataUpdate.group_uuid);
expect(res.body.consumable).to.be.equal(metadataUpdate.consumable);
expect(res.body.manufacturer_brand).to.be.equal(metadataUpdate.manufacturer_brand);
expect(res.body.manufacturer_model).to.be.equal(metadataUpdate.manufacturer_model);
})
.catch(helpers.handler);
});
Expand Down
2 changes: 2 additions & 0 deletions test/integration/inventory/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const inventoryType = {

const updateType = {
text : '[Test] Article Chirurgie',
description : 'Description de l\'article chirurgie',
is_predefined : 0,
};

const inventoryUnit = {
Expand Down

0 comments on commit a8a228a

Please sign in to comment.