-
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 #22 from GHImplementationTeam/production
tests from Production
- Loading branch information
Showing
10 changed files
with
692 additions
and
1 deletion.
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
Empty file.
Empty file.
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,115 @@ | ||
let expect = require('chai').expect; | ||
let calculateAcuityScore = require("../../assets/js/services/AcuityService.js").score; | ||
let calculateAcuityRec = require("../../assets/js/services/AcuityService.js").recommendation; | ||
|
||
describe('Calculate acuity score', () => { | ||
|
||
it('should handle empty requests', function () { | ||
let intended_score = 0; | ||
let intake = {}; | ||
options = { | ||
"intake": intake | ||
}; | ||
let calculated_score = calculateAcuityScore(options); | ||
let housing_recommendation = calculateAcuityRec(calculated_score); | ||
expect(calculated_score).to.be.a('number'); | ||
expect(calculated_score).to.equal(intended_score); | ||
expect(housing_recommendation) | ||
.to.equal("Not recommended for a Housing and Support Assessment at this time"); | ||
}); | ||
|
||
it('should calculate the acuity score for an incomplete response set', function () { | ||
let intended_score = 2; | ||
let intake = JSON.parse('{"General_1": 67, "Social_7": true}'); | ||
options = { | ||
"intake": intake | ||
}; | ||
let calculated_score = calculateAcuityScore(options); | ||
let housing_recommendation = calculateAcuityRec(calculated_score); | ||
expect(calculated_score).to.be.a('number'); | ||
expect(calculated_score).to.equal(intended_score); | ||
expect(housing_recommendation) | ||
.to.equal("Not recommended for a Housing and Support Assessment at this time"); | ||
}); | ||
|
||
it('should calculate the minimum VI-SPDAT score', () => { | ||
let intended_score = 0; | ||
let fs = require('fs'); | ||
let intake = fs.readFileSync(__dirname + '/test_data/minScore.json', 'utf8'); | ||
intake = JSON.parse(intake); | ||
options = { | ||
"intake": intake | ||
}; | ||
let calculated_score = calculateAcuityScore(options); | ||
let housing_recommendation = calculateAcuityRec(calculated_score); | ||
expect(calculated_score).to.be.a('number'); | ||
expect(calculated_score).to.equal(intended_score); | ||
expect(housing_recommendation) | ||
.to.equal("Not recommended for a Housing and Support Assessment at this time"); | ||
}); | ||
|
||
it('should calculate the maximum VI-SPDAT score', () => { | ||
let intended_score = 20; | ||
let fs = require('fs'); | ||
let intake = fs.readFileSync(__dirname + '/test_data/maxScore.json', 'utf8'); | ||
intake = JSON.parse(intake); | ||
options = { | ||
"intake": intake | ||
}; | ||
let calculated_score = calculateAcuityScore(options); | ||
let housing_recommendation = calculateAcuityRec(calculated_score); | ||
expect(calculated_score).to.be.a('number'); | ||
expect(calculated_score).to.equal(intended_score); | ||
expect(housing_recommendation) | ||
.to.equal("Recommended for a Permanent Supportive Housing/Housing First Assessment"); | ||
}); | ||
|
||
it('should calculate a VI-SPDAT score that recommends no housing assessment', () => { | ||
let intended_score = 4; | ||
let fs = require('fs'); | ||
let intake = fs.readFileSync(__dirname + '/test_data/noRecc.json', 'utf8'); | ||
intake = JSON.parse(intake); | ||
options = { | ||
"intake": intake | ||
}; | ||
let calculated_score = calculateAcuityScore(options); | ||
let housing_recommendation = calculateAcuityRec(calculated_score); | ||
expect(calculated_score).to.be.a('number'); | ||
expect(calculated_score).to.equal(intended_score); | ||
expect(housing_recommendation) | ||
.to.equal("Not recommended for a Housing and Support Assessment at this time"); | ||
}); | ||
|
||
it('should calculate a VI-SPDAT score that recommends a rapid re-housing assessment', () => { | ||
let intended_score = 5; | ||
let fs = require('fs'); | ||
let intake = fs.readFileSync(__dirname + '/test_data/rapidRecc.json', 'utf8'); | ||
intake = JSON.parse(intake); | ||
options = { | ||
"intake": intake | ||
}; | ||
let calculated_score = calculateAcuityScore(options); | ||
let housing_recommendation = calculateAcuityRec(calculated_score); | ||
expect(calculated_score).to.be.a('number'); | ||
expect(calculated_score).to.equal(intended_score); | ||
expect(housing_recommendation) | ||
.to.equal("Recommended for a Rapid Re-Housing Assessment"); | ||
}); | ||
|
||
it('should calculate a VI-SPDAT score that recommends permanent supportive housing', () => { | ||
let intended_score = 12; | ||
let fs = require('fs'); | ||
let intake = fs.readFileSync(__dirname + '/test_data/permRecc.json', 'utf8'); | ||
intake = JSON.parse(intake); | ||
options = { | ||
"intake": intake | ||
}; | ||
let calculated_score = calculateAcuityScore(options); | ||
let housing_recommendation = calculateAcuityRec(calculated_score); | ||
expect(calculated_score).to.be.a('number'); | ||
expect(calculated_score).to.equal(intended_score); | ||
expect(housing_recommendation) | ||
.to.equal("Recommended for a Permanent Supportive Housing/Housing First Assessment"); | ||
}); | ||
|
||
}); |
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,53 @@ | ||
{ | ||
"General_1": 60, | ||
"Housing_1": 5, | ||
"Housing_2": 10, | ||
"Risks_1": 10, | ||
"Risks_2": 10, | ||
"Risks_3": 10, | ||
"Risks_4": 10, | ||
"Risks_5": 10, | ||
"Risks_6": true, | ||
"Risks_7": true, | ||
"Risks_8": true, | ||
"Risks_9": true, | ||
"Risks_10": true, | ||
"Risks_11": "Bus or Subway", | ||
"Social_1": true, | ||
"Social_2": false, | ||
"Social_3": false, | ||
"Social_4": false, | ||
"Social_5": true, | ||
"Social_6": true, | ||
"Social_7": true, | ||
"Wellness_1": "Does not go for care", | ||
"Wellness_2": true, | ||
"Wellness_3": true, | ||
"Wellness_4": true, | ||
"Wellness_5": true, | ||
"Wellness_6": true, | ||
"Wellness_7": true, | ||
"Wellness_8": true, | ||
"Wellness_9": true, | ||
"Wellness_10": true, | ||
"Wellness_11": true, | ||
"Wellness_12": true, | ||
"Wellness_13": true, | ||
"Wellness_14": true, | ||
"Wellness_15": true, | ||
"Wellness_16": true, | ||
"Wellness_17": true, | ||
"Wellness_18": true, | ||
"Wellness_19": true, | ||
"Wellness_20": true, | ||
"Wellness_21": true, | ||
"Wellness_22": true, | ||
"Wellness_23": true, | ||
"Wellness_24": true, | ||
"Wellness_25": true, | ||
"Wellness_26": true, | ||
"Wellness_27": true, | ||
"Wellness_28": true, | ||
"Wellness_29": true, | ||
"Wellness_30": true | ||
} |
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,53 @@ | ||
{ | ||
"General_1": 33, | ||
"Housing_1": 0, | ||
"Housing_2": 0, | ||
"Risks_1": 0, | ||
"Risks_2": 0, | ||
"Risks_3": 0, | ||
"Risks_4": 0, | ||
"Risks_5": 0, | ||
"Risks_6": false, | ||
"Risks_7": false, | ||
"Risks_8": false, | ||
"Risks_9": false, | ||
"Risks_10": false, | ||
"Risks_11": "Shelter", | ||
"Social_1": false, | ||
"Social_2": true, | ||
"Social_3": true, | ||
"Social_4": true, | ||
"Social_5": false, | ||
"Social_6": false, | ||
"Social_7": false, | ||
"Wellness_1": "Hospital", | ||
"Wellness_2": false, | ||
"Wellness_3": false, | ||
"Wellness_4": false, | ||
"Wellness_5": false, | ||
"Wellness_6": false, | ||
"Wellness_7": false, | ||
"Wellness_8": false, | ||
"Wellness_9": false, | ||
"Wellness_10": false, | ||
"Wellness_11": false, | ||
"Wellness_12": false, | ||
"Wellness_13": false, | ||
"Wellness_14": false, | ||
"Wellness_15": false, | ||
"Wellness_16": false, | ||
"Wellness_17": false, | ||
"Wellness_18": false, | ||
"Wellness_19": false, | ||
"Wellness_20": false, | ||
"Wellness_21": false, | ||
"Wellness_22": false, | ||
"Wellness_23": false, | ||
"Wellness_24": false, | ||
"Wellness_25": false, | ||
"Wellness_26": false, | ||
"Wellness_27": false, | ||
"Wellness_28": false, | ||
"Wellness_29": false, | ||
"Wellness_30": false | ||
} |
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,53 @@ | ||
{ | ||
"General_1": 33, | ||
"Housing_1": 0, | ||
"Housing_2": 0, | ||
"Risks_1": 1, | ||
"Risks_2": 1, | ||
"Risks_3": 0, | ||
"Risks_4": 1, | ||
"Risks_5": 0, | ||
"Risks_6": false, | ||
"Risks_7": true, | ||
"Risks_8": false, | ||
"Risks_9": false, | ||
"Risks_10": false, | ||
"Risks_11": "Shelter", | ||
"Social_1": false, | ||
"Social_2": true, | ||
"Social_3": false, | ||
"Social_4": true, | ||
"Social_5": false, | ||
"Social_6": false, | ||
"Social_7": false, | ||
"Wellness_1": "Hospital", | ||
"Wellness_2": false, | ||
"Wellness_3": false, | ||
"Wellness_4": false, | ||
"Wellness_5": false, | ||
"Wellness_6": false, | ||
"Wellness_7": false, | ||
"Wellness_8": false, | ||
"Wellness_9": false, | ||
"Wellness_10": false, | ||
"Wellness_11": false, | ||
"Wellness_12": true, | ||
"Wellness_13": false, | ||
"Wellness_14": false, | ||
"Wellness_15": false, | ||
"Wellness_16": false, | ||
"Wellness_17": false, | ||
"Wellness_18": false, | ||
"Wellness_19": false, | ||
"Wellness_20": false, | ||
"Wellness_21": false, | ||
"Wellness_22": false, | ||
"Wellness_23": false, | ||
"Wellness_24": false, | ||
"Wellness_25": false, | ||
"Wellness_26": false, | ||
"Wellness_27": false, | ||
"Wellness_28": false, | ||
"Wellness_29": true, | ||
"Wellness_30": true | ||
} |
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,53 @@ | ||
{ | ||
"General_1": 63, | ||
"Housing_1": 2, | ||
"Housing_2": 0, | ||
"Risks_1": 1, | ||
"Risks_2": 1, | ||
"Risks_3": 2, | ||
"Risks_4": 1, | ||
"Risks_5": 0, | ||
"Risks_6": false, | ||
"Risks_7": true, | ||
"Risks_8": false, | ||
"Risks_9": false, | ||
"Risks_10": false, | ||
"Risks_11": "Shelter", | ||
"Social_1": false, | ||
"Social_2": true, | ||
"Social_3": false, | ||
"Social_4": true, | ||
"Social_5": false, | ||
"Social_6": false, | ||
"Social_7": false, | ||
"Wellness_1": "Does not go for care", | ||
"Wellness_2": true, | ||
"Wellness_3": false, | ||
"Wellness_4": false, | ||
"Wellness_5": true, | ||
"Wellness_6": false, | ||
"Wellness_7": false, | ||
"Wellness_8": false, | ||
"Wellness_9": false, | ||
"Wellness_10": false, | ||
"Wellness_11": false, | ||
"Wellness_12": false, | ||
"Wellness_13": false, | ||
"Wellness_14": false, | ||
"Wellness_15": false, | ||
"Wellness_16": true, | ||
"Wellness_17": false, | ||
"Wellness_18": false, | ||
"Wellness_19": false, | ||
"Wellness_20": false, | ||
"Wellness_21": false, | ||
"Wellness_22": false, | ||
"Wellness_23": true, | ||
"Wellness_24": false, | ||
"Wellness_25": false, | ||
"Wellness_26": false, | ||
"Wellness_27": false, | ||
"Wellness_28": false, | ||
"Wellness_29": false, | ||
"Wellness_30": true | ||
} |
Oops, something went wrong.