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

Update ember-pouch to the latest version 🚀 #858

Merged
merged 22 commits into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
16 changes: 14 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
---
language: node_js
node_js:
- "4"
- "6"

branches:
only:
- "master"

sudo: false
dist: trusty
sudo: required

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable

cache:
directories:
- $HOME/.npm
- $HOME/.cache # includes bowers cache

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- npm config set spin false
- npm install -g bower phantomjs-prebuilt
- bower --version
- phantomjs --version
- google-chrome --version


install:
- npm install
Expand Down
12 changes: 9 additions & 3 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Ember from 'ember';
import { Adapter } from 'ember-pouch';
import uuid from 'npm:uuid';
import withTestWaiter from 'ember-concurrency-test-waiter/with-test-waiter';
import { Adapter } from 'ember-pouch';
import { task } from 'ember-concurrency';

const {
get,
Expand Down Expand Up @@ -263,13 +265,17 @@ export default Adapter.extend({
return this._checkForErrors(this._super(store, type, record));
},

_checkForErrors(callPromise) {
return new Ember.RSVP.Promise((resolve, reject) => {
checkForErrorsTask: withTestWaiter(task(function* (callPromise) {
return yield new Ember.RSVP.Promise((resolve, reject) => {
callPromise.then(resolve, (err) => {
let database = get(this, 'database');
reject(database.handleErrorResponse(err));
});
});
})),

_checkForErrors(callPromise) {
return get(this, 'checkForErrorsTask').perform(callPromise);
}

});
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@
"ember-cli-test-loader": "^1.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-concurrency": "0.8.1",
"ember-concurrency-test-waiter": "0.2.0",
"ember-data": "^2.10.0",
"ember-export-application-global": "^1.0.5",
"ember-fullcalendar": "1.3.0",
"ember-i18n": "4.4.0",
"ember-keyboard": "2.1.9",
"ember-load-initializers": "^0.6.0",
"ember-pouch": "4.2.1",
"ember-pouch": "4.2.4",
"ember-radio-buttons": "^4.0.1",
"ember-rapid-forms": "1.0.0-beta10",
"ember-resolver": "^2.0.3",
Expand All @@ -87,9 +88,8 @@
"hospitalrun-server-routes": "0.9.11",
"loader.js": "^4.0.11",
"nano": "6.2.0",
"pouchdb": "5.4.5",
"pouchdb-adapter-memory": "^6.0.7",
"pouchdb-core": "^6.0.7",
"pouchdb": "6.1.2",
"pouchdb-adapter-memory": "6.1.2",
"pouchdb-list": "^1.1.0",
"request": "2.79.0",
"stylelint": "~7.7.1",
Expand Down
43 changes: 33 additions & 10 deletions tests/acceptance/visit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,43 @@ test('Add admission visit', function(assert) {
runWithPouchDump('patient', function() {
authenticateUser();
addVisit(assert);
addAdmissionData(assert);
newReport(assert, 'Discharge');
checkDischargeReport(assert);
saveReport(assert, 'Discharge');
viewReport(assert, 'Discharge');
andThen(() => {
addAdmissionData(assert);
});
andThen(() => {
newReport(assert, 'Discharge');
});
andThen(() => {
checkDischargeReport(assert);
});
andThen(() => {
saveReport(assert, 'Discharge');
});
andThen(() => {
viewReport(assert, 'Discharge');
});
});
});

test('Add OPD visit', function(assert) {
runWithPouchDump('patient', function() {
authenticateUser();
addVisit(assert, 'Clinic');
addOutpatientData(assert);
newReport(assert, 'OPD');
checkOPDReport(assert);
saveReport(assert, 'OPD');
viewReport(assert, 'OPD');
andThen(() => {
addOutpatientData(assert);
});
andThen(() => {
newReport(assert, 'OPD');
});
andThen(() => {
checkOPDReport(assert);
});
andThen(() => {
saveReport(assert, 'OPD');
});
andThen(() => {
viewReport(assert, 'OPD');
});
});
});

Expand Down Expand Up @@ -278,10 +298,13 @@ function addOutpatientData(assert) {
assert.equal(find('.modal-title').text(), 'Add Diagnosis', 'Add Diagnosis dialog displays');
fillIn('.diagnosis-text input', visitData.outPatient.SECONDARY_DIAGNOSIS);
click('.secondary-diagnosis input');
});
andThen(() => {
click('.modal-footer button:contains(Add)');
});
andThen(function() {
waitToDisappear('.modal-dialog');
waitToAppear(`a.secondary-diagnosis:contains(${visitData.outPatient.SECONDARY_DIAGNOSIS})`);
});
andThen(() => {
click('a:contains(Add Operative Plan)');
Expand Down
6 changes: 5 additions & 1 deletion tests/helpers/run-with-pouch-dump.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ function runWithPouchDumpAsyncHelper(app, dumpName, functionToRun) {
cleanupDatabases({
config: configDB,
main: db
}).then(resolve, function(err) {
}).then(function() {
configDB = null;
db = null;
resolve();
}, function(err) {
console.log('error cleaning up dbs:', JSON.stringify(err, null, 2));
});
});
Expand Down