Unit Testing: Active Fill V2 - CBTYoung/Documentation GitHub Wiki

import { ActiveFill } from "../../../../src/architecture/business_layer/modules/ReportStrategies/ActiveFill";
import { bodyParts, BodyPartSelection } from "../../../../src/architecture/business_layer/modules/ReportStrategies/BodyPartSelection";


describe("Active Fill tests", () => {
   

    test('adding empty event', () => {
        expect(() => new ActiveFill("")).toThrow(ActiveFill.emptyEventError);
    });
    test('adding empty event with all other variables filled', () => {
        expect(() => new ActiveFill("", [], "stomach", "my", "world")).toThrow(ActiveFill.emptyEventError);
    });

    test('adding correct event with all other variables filled', () => {
        expect(() => new ActiveFill("feeling good", [], "stomach", "my", "world")).not.toThrow(ActiveFill.emptyEventError);
    });

    test('adding correct event with body part selection', () => {
        expect(() => new ActiveFill("feeling good", [], "stomach", "my", "world")).not.toThrow(ActiveFill.emptyEventError);
    });
});
describe("Active Fill Summary tests", () => {
    
    test('checking get summary with all string data', () =>{
        expect("The event:feeling good\nThe bodyPart: stomach\nThe thought: my\nThe response: world")
        .toBe(new ActiveFill("feeling good", [], "stomach", "my", "world").getSummary());
    });

    test('checking get summary with only event data', () =>{
        expect("The event:feeling good")
        .toBe(new ActiveFill("feeling good").getSummary());
    });

    
    test('checking get summary with only event  and emotion data', () =>{
        expect("The event:feeling good\nThe bodyPart: stomach")
        .toBe(new ActiveFill("feeling good",[],"stomach").getSummary());
    });

    
    test('checking get summary with only event and body part data', () =>{
        expect("The event:feeling good\nThe bodyPart: stomach")
        .toBe(new ActiveFill("feeling good",[],"stomach").getSummary());
    });

});