UNPKG

@pact-foundation/pact

Version:
34 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const v4_1 = require("../../v4"); const responseWithPluginBuilder_1 = require("./responseWithPluginBuilder"); describe('V4 ResponseWithPluginBuilder', () => { let withResponseBody; let interaction; let builder; beforeEach(() => { withResponseBody = vitest_1.vi.fn(); interaction = { withResponseBody }; builder = new responseWithPluginBuilder_1.ResponseWithPluginBuilder(interaction); }); afterEach(() => { vitest_1.vi.restoreAllMocks(); }); describe('#xmlBody', () => { it('calls withResponseBody with application/xml content type', () => { const body = new v4_1.XmlBuilder('1.0', 'UTF-8', 'root').build((el) => { el.appendElement('item', new Map(), 'value'); }); builder.xmlBody(body); expect(withResponseBody).toHaveBeenCalledOnce(); expect(withResponseBody).toHaveBeenCalledWith(body, 'application/xml'); }); it('returns the builder for chaining', () => { const body = new v4_1.XmlBuilder('1.0', 'UTF-8', 'root').build(() => { }); const result = builder.xmlBody(body); expect(result).toBe(builder); }); }); }); //# sourceMappingURL=responseWithPluginBuilder.spec.js.map