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

Commit

Permalink
Add model unit test for patient-note (#875)
Browse files Browse the repository at this point in the history
- Add model unit test for patient-note
  • Loading branch information
mkly authored and jkleinsc committed Dec 15, 2016
1 parent 4705f54 commit 75d8bdf
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/unit/models/patient-note-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { moduleForModel, test } from 'ember-qunit';
import Ember from 'ember';
import tHelper from 'ember-i18n/helper';
import localeConfig from 'ember-i18n/config/en';

moduleForModel('patient-note', 'Unit | Model | patient-note', {
needs: [
'ember-validations@validator:local/presence',
'service:i18n',
'locale:en/translations',
'locale:en/config',
'util:i18n/missing-message',
'util:i18n/compile-template',
'config:environment',
'model:patient',
'model:visit'
],
beforeEach() {
// set the locale and the config
this.container.lookup('service:i18n').set('locale', 'en');
this.registry.register('locale:en/config', localeConfig);

// manually inject the i18n service as initialzer does not run
// in unit test
Ember.getOwner(this).inject('model', 'i18n', 'service:i18n');

// register t helper
this.registry.register('helper:t', tHelper);
}
});

test('authoredBy', function(assert) {
let patientNote = this.subject({
createdBy: 'Test Person'
});

assert.strictEqual(patientNote.get('authoredBy'), 'Test Person');
});

test('authoredBy', function(assert) {
let patientNote = this.subject({
createdBy: 'Test Person',
attribution: 'Test Organization'
});

assert.strictEqual(patientNote.get('authoredBy'), 'Test Person on behalf of Test Organization');
});

0 comments on commit 75d8bdf

Please sign in to comment.