all files / modules/extensions/__tests__/ acceptEncoding-test.js

100% Statements 13/13
100% Branches 0/0
100% Functions 6/6
100% Lines 13/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                      
const expect = require("expect");
const mach = require("../../index");
 
describe("extensions/acceptEncoding", function () {
    beforeEach(function () {
        mach.extend(require("../acceptEncoding"));
    });
 
    describe("a message with an Accept-Encoding header", function () {
        let message;
        beforeEach(function () {
            message = new mach.Message(null, {"Accept-Encoding": "gzip"});
        });
 
        it("accepts acceptable encodings", function () {
            expect(message.acceptsEncoding("gzip")).toBe(true);
        });
 
        it("does not accept unacceptable encodings", function () {
            expect(message.acceptsEncoding("compress")).toBe(false);
        });
    });
});