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

Add model unit test for proc-charge #882

Merged
merged 1 commit into from
Dec 16, 2016
Merged
Changes from all 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
65 changes: 65 additions & 0 deletions tests/unit/models/proc-charge-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { moduleForModel, test } from 'ember-qunit';
import Ember from 'ember';

moduleForModel('proc-charge', 'Unit | Model | proc-charge', {
needs: [
'ember-validations@validator:local/presence',
'ember-validations@validator:local/numericality',
'ember-validations@validator:local/acceptance',
'model:inventory',
'model:inv-purchase',
'model:inv-location',
'model:pricing'
]
});

test('medicationCharge', function(assert) {
let medication = Ember.run(() => this.store().createRecord('inventory'));
let procCharge = this.subject({
newMedicationCharge: 11,
medication
});

assert.strictEqual(procCharge.get('medicationCharge'), true);
});

test('medicationCharge both empty', function(assert) {
let procCharge = this.subject();

assert.strictEqual(procCharge.get('medicationCharge'), false);
});

test('medicationChange empty medication', function(assert) {
let procCharge = this.subject({
newMedicationCharge: 12
});

assert.strictEqual(procCharge.get('medicationCharge'), true);
});

test('medicationCharge empty newMedicationCharge', function(assert) {
let medication = Ember.run(() => this.store().createRecord('inventory'));
let procCharge = this.subject({ medication });

assert.strictEqual(procCharge.get('medicationCharge'), true);
});

test('medicationName', function(assert) {
let medication = Ember.run(() => this.store().createRecord('inventory', {
name: 'Test Item',
price: 12.5
}));
let procCharge = this.subject({ medication });

assert.strictEqual(procCharge.get('medicationName'), 'Test Item');
});

test('medicationPrice', function(assert) {
let medication = Ember.run(() => this.store().createRecord('inventory', {
name: 'Testing',
price: 133.59
}));
let procCharge = this.subject({ medication });

assert.strictEqual(procCharge.get('medicationPrice'), 133.59);
});