Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Define Incorrect Behavior of haveInvoiceItems #871

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/inventory-batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Ember from 'ember';
export default AbstractModel.extend({
haveInvoiceItems() {
let invoiceItems = this.get('invoiceItems');
return (Ember.isEmpty(invoiceItems));
return !Ember.isEmpty(invoiceItems);
},

validations: {
Expand Down
22 changes: 22 additions & 0 deletions tests/unit/models/inventory-batch-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { moduleForModel, test } from 'ember-qunit';

moduleForModel('inventory-batch', 'Unit | Model | inventory-batch', {
needs: [
'ember-validations@validator:local/presence',
'ember-validations@validator:local/numericality'
]
});

test('haveInvoiceItems', function(assert) {
let inventoryBatch = this.subject({
invoiceItems: ['test']
});

assert.strictEqual(inventoryBatch.haveInvoiceItems(), true);
});

test('haveInvoiceItems false', function(assert) {
let inventoryBatch = this.subject();

assert.strictEqual(inventoryBatch.haveInvoiceItems(), false);
});