This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6c262a
commit 7373e8d
Showing
5 changed files
with
48 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
roots: ['<rootDir>/src'], | ||
testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'], | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import '../__mocks__/matchMediaMock' | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { mount } from 'enzyme' | ||
import HospitalRun from '../containers/HospitalRun' | ||
import App from '../App' | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div') | ||
ReactDOM.render(<App />, div) | ||
ReactDOM.unmountComponentAtNode(div) | ||
const wrapper = mount(<App />) | ||
expect(wrapper.find(HospitalRun)).toHaveLength(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
import PouchDB from 'pouchdb' | ||
|
||
export const patients = new PouchDB('patients') | ||
PouchDB.sync( | ||
'patients', | ||
'https://a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix:cd6f332d39f24d2b7cfc89d82f6836d46012ef3188698319b0d5fff177cb2ddc@a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix.cloudantnosqldb.appdomain.cloud/patients', | ||
// IBM Cloudant testing and developing database | ||
{ | ||
live: true, | ||
retry: true, | ||
}, | ||
).on('change', (info) => { | ||
// handle change | ||
console.log(info) | ||
}) | ||
// eslint-disable-next-line | ||
const memoryAdapter = require('pouchdb-adapter-memory') | ||
|
||
PouchDB.plugin(memoryAdapter) | ||
|
||
function createDb(name: string) { | ||
if (process.env.NODE_ENV === 'test') { | ||
return new PouchDB(name, { adapter: 'memory' }) | ||
} | ||
|
||
const db = new PouchDB(name) | ||
db.sync( | ||
`https://a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix:cd6f332d39f24d2b7cfc89d82f6836d46012ef3188698319b0d5fff177cb2ddc@a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix.cloudantnosqldb.appdomain.cloud/${name}`, | ||
{ | ||
live: true, | ||
retry: true, | ||
}, | ||
).on('change', (info) => { | ||
console.log(info) | ||
}) | ||
|
||
return db | ||
} | ||
|
||
export const patients = createDb('patients') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import Enzyme from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
|
||
Enzyme.configure({ adapter: new Adapter() }) |