All files / src/server/utils header.js

70% Statements 7/10
50% Branches 2/4
100% Functions 2/2
70% Lines 7/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23    8x 8x 8x     2x   1x   1x                   1x  
class Header {
    constructor(header, logicalOp, value) {
        this.header = header;
        this.logicalOp = logicalOp;
        this.value = value;
    }
    match(matchTo) {
        switch (this.logicalOp) {
            case "equalTo":
                return this.value === matchTo;
            case "matches":
                return RegExp(this.value).test(matchTo);
                case "contains":
                    return this.value.includes(matchTo);
            default:
                console.log(this.logicalOp, 'is not defined');
                return false;
        }
    }
}
 
module.exports = Header