forked from Medable/mdctl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Medable#422 from Medable/release/1.0.68
Release/1.0.68
- Loading branch information
Showing
64 changed files
with
9,209 additions
and
2,550 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,6 @@ | ||
{ | ||
"name": "@medable/mdctl-api-ws", | ||
"version": "1.0.67", | ||
"version": "1.0.68", | ||
"description": "Medable Developer Client Tools :: Websocket Client", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -25,9 +25,9 @@ | |
"author": "Medable, Inc. <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@medable/mdctl-core": "^1.0.67", | ||
"@medable/mdctl-core-utils": "^1.0.67", | ||
"@medable/mdctl-secrets": "^1.0.67", | ||
"@medable/mdctl-core": "^1.0.68", | ||
"@medable/mdctl-core-utils": "^1.0.68", | ||
"@medable/mdctl-secrets": "^1.0.68", | ||
"jsonwebtoken": "^8.5.1", | ||
"lodash": "^4.17.21", | ||
"primus": "^7.3.4", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,6 @@ | ||
{ | ||
"name": "@medable/mdctl-api", | ||
"version": "1.0.67", | ||
"version": "1.0.68", | ||
"description": "Medable Developer Client Tools :: API", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -25,8 +25,8 @@ | |
"author": "Medable, Inc. <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@medable/mdctl-core": "^1.0.67", | ||
"@medable/mdctl-core-utils": "^1.0.67", | ||
"@medable/mdctl-core": "^1.0.68", | ||
"@medable/mdctl-core-utils": "^1.0.68", | ||
"axios": "^0.21.1", | ||
"axios-cookiejar-support": "^0.5.0", | ||
"clone": "^2.1.2", | ||
|
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
138 changes: 138 additions & 0 deletions
138
packages/mdctl-axon-tools/__tests__/MIG-136/MIG-136.test.js
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,138 @@ | ||
const { pick } = require('lodash'), | ||
StudyManifestTools = require('../../lib/StudyManifestTools'), | ||
existingStudy = [{ | ||
_id: '1', | ||
c_name: 'Study', | ||
c_key: 'abc' | ||
}], | ||
existingTasks = [{ | ||
_id: '1', | ||
c_name: 'Task 1', | ||
c_study: '1', | ||
c_key: '123-456-789' | ||
}, | ||
{ | ||
_id: '2', | ||
c_name: 'Task 2', | ||
c_study: '1', | ||
ec__key: '234-567-890' | ||
}, | ||
{ | ||
_id: '3', | ||
c_name: 'Task 3', | ||
c_study: '2', | ||
ec__key: '345-678-901' | ||
}], | ||
existingConsent = [{ | ||
_id: '1', | ||
ec__status: 'draft', | ||
ec__title: 'title', | ||
ec__identifier: 'Test Template 1', | ||
ec__study: '2', | ||
ec__key: '456-789-012' | ||
}, | ||
{ | ||
_id: '2', | ||
ec__status: 'draft', | ||
ec__title: 'title', | ||
ec__identifier: 'Test Template 2', | ||
ec__study: '1', | ||
ec__key: '567-890-123' | ||
}], | ||
|
||
org = { | ||
objects: { | ||
c_study: { | ||
find: () => ({ | ||
paths: () => ({ | ||
toArray: () => existingStudy | ||
}) | ||
}) | ||
}, | ||
c_tasks: { | ||
find: study => ({ | ||
limit: () => ({ | ||
paths: (...props) => ({ | ||
toArray: () => { | ||
const result = existingTasks.filter(t => t.c_study === study.c_study), | ||
res = result ? result.map(item => Object.assign( | ||
...props.map(prop => ({ [prop]: item[prop] })) | ||
)) : [] | ||
return res | ||
} | ||
}) | ||
}) | ||
}) | ||
}, | ||
ec__document_templates: { | ||
find: study => ({ | ||
limit: () => ({ | ||
paths: (...props) => ({ | ||
toArray: () => { | ||
const result = existingConsent.filter(e => e.ec__study === study.ec__study), | ||
res = result ? result.map(item => Object.assign( | ||
...props.map(prop => ({ [prop]: item[prop] })) | ||
)) : [] | ||
return res | ||
} | ||
}) | ||
}) | ||
}) | ||
} | ||
} | ||
} | ||
|
||
describe('MIG-136 - Orphan records', () => { | ||
|
||
beforeEach(() => { | ||
jest.spyOn(StudyManifestTools.prototype, 'getOrg').mockImplementation(() => org) | ||
}) | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
|
||
it('Should returns only existing study Assignments', async() => { | ||
const studyManifestTools = new StudyManifestTools(), | ||
tasks = await studyManifestTools.getTasks(), | ||
// eslint-disable-next-line no-underscore-dangle | ||
test = existingTasks.filter(t => t.c_study === existingStudy[0]._id) | ||
.map(t => pick(t, ['c_name'])) | ||
|
||
expect(tasks).toStrictEqual(test) | ||
}) | ||
|
||
it('Should returns no Assignments if study does not exists', async() => { | ||
// Overwrite function to return an empty array | ||
org.objects.c_study.find = () => ({ paths: () => ({ toArray: () => [] }) }) | ||
const studyManifestTools = new StudyManifestTools(), | ||
tasks = await studyManifestTools.getTasks() | ||
|
||
expect(tasks).toStrictEqual([]) | ||
|
||
// Restoring function to its previous value | ||
org.objects.c_study.find = () => ({ paths: () => ({ toArray: () => existingStudy }) }) | ||
}) | ||
|
||
it('Should returns only existing study eTemplates', async() => { | ||
const studyManifestTools = new StudyManifestTools(), | ||
templates = await studyManifestTools.getConsentTemplates(), | ||
test = pick(existingConsent[1], ['ec__identifier', 'ec__title']) | ||
|
||
expect(templates[0]).toStrictEqual(test) | ||
|
||
}) | ||
|
||
it('Should returns no eTemplates if study does not exists', async() => { | ||
// Overwrite function to return an empty array | ||
org.objects.c_study.find = () => ({ paths: () => ({ toArray: () => [] }) }) | ||
const studyManifestTools = new StudyManifestTools(), | ||
templates = await studyManifestTools.getConsentTemplates() | ||
|
||
expect(templates).toStrictEqual([]) | ||
|
||
// Restoring function to its previous value | ||
org.objects.c_study.find = () => ({ paths: () => ({ toArray: () => existingStudy }) }) | ||
}) | ||
|
||
}) |
Oops, something went wrong.