import { AutomaticThoughtsResponse } from "../../src/architecture/business_layer/modules/AutomaticThoughtsResponse";
import { CBTReportContext } from "../../src/architecture/business_layer/modules/CBTReportContext";
import { ActiveFill } from "../../src/architecture/business_layer/modules/ReportStrategies/ActiveFill";
import { bodyParts, BodyPartSelection } from "../../src/architecture/business_layer/modules/ReportStrategies/BodyPartSelection";
import { Patient } from "../../src/architecture/business_layer/Patient";
describe("Paitent add modules tests", () => {
test('checking add module with one report', () =>{
const date = new Date(Date.now());
const fill = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report = new CBTReportContext(date,fill);
const patient = new Patient("Guy","gg")
patient.addModule(report)
expect(patient.modules.length).toBe(1);
});
test('checking add module with one report', () =>{
const date = new Date(Date.now());
const fill1 = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report1 = new CBTReportContext(date,fill1);
const fill2 = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report2 = new CBTReportContext(date,fill2);
const patient = new Patient("Guy","gg");
patient.addModule(report1);
expect(patient.modules.length).toBe(1);
patient.addModule(report2);
expect(patient.modules.length).toBe(2);
});
test('checking add module with one report', () =>{
const date = new Date(Date.now());
const fill1 = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report1 = new CBTReportContext(date,fill1);
const thought ="I'm pretty";
const auto1 = new AutomaticThoughtsResponse(date, thought);
const res1 = "yes u are";
const res2 = "beauty";
auto1.addResponse(res1);
auto1.addResponse(res2);
const patient = new Patient("Guy","gg");
patient.addModule(report1);
expect(patient.modules.length).toBe(1);
patient.addModule(auto1);
expect(patient.modules.length).toBe(2);
});
});
describe("Paitent Summary tests", () => {
test('checking getsummary with one report', () =>{
const date = new Date(Date.now());
const fill = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report = new CBTReportContext(date,fill);
const patient = new Patient("Guy","gg")
patient.addModule(report)
expect(patient.modules.length).toBe(1);
expect(patient.getSummary())
.toBe(report.getSummary());
});
test('checking get summary with two reports', () =>{
const date = new Date(Date.now());
const fill1 = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report1 = new CBTReportContext(date,fill1);
const fill2 = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report2 = new CBTReportContext(date,fill2);
const patient = new Patient("Guy","gg");
patient.addModule(report1);
expect(patient.modules.length).toBe(1);
patient.addModule(report2);
expect(patient.modules.length).toBe(2);
expect(patient.getSummary())
.toBe(report1.getSummary()+"\n"+report2.getSummary());
});
test('checking get summary with no reports', () =>{
const patient = new Patient("Guy","gg");
expect(patient.modules.length).toBe(0);
expect("")
.toBe(patient.getSummary());
});
test('checking get summary with two modules one auto one report', () =>{
const date = new Date(Date.now());
const fill1 = new ActiveFill("feeling good", [],new BodyPartSelection(bodyParts.stomach), "my", "world");
const report1 = new CBTReportContext(date,fill1);
const thought ="I'm pretty";
const auto1 = new AutomaticThoughtsResponse(date, thought);
const res1 = "yes u are";
const res2 = "beauty";
auto1.addResponse(res1);
auto1.addResponse(res2);
const patient = new Patient("Guy","gg");
patient.addModule(report1);
expect(patient.modules.length).toBe(1);
patient.addModule(auto1);
expect(patient.modules.length).toBe(2);
expect(patient.getSummary())
.toBe(report1.getSummary()+"\n"+auto1.getSummary());
});
});