Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('handles missing content object', () => {
// no content object at all
const dat = deepclone({ response });
emit(dat, action);
assert.deepEqual(dat, { response, content: {} });
});
});
it('Testing no debug', () => {
const context = getContext();
context.request.params.debug = false;
debug(context, { logger });
assert.deepEqual(context, deepclone(context));
});
it('does nothing if no JSON object specified', () => {
const dat = deepclone({ content: {}, response });
emit(dat, action);
assert(dat, { content: {}, response });
});
it('builds XML from object', () => {
const data = deepclone(context);
emit(data, action);
assert.deepEqual(data.response.body, expectedXML);
});
it('Ignores non-HTML', () => {
const dat = {
response: {
body: '{}',
headers: {
'Content-Type': 'application/json',
},
},
};
const dat2 = deepclone(dat);
rewrite(dat);
assertEquals(dat, dat2);
});
it('keeps existing response body', () => {
context.response.body = expectedXML;
const data = deepclone(context);
emit(data, action);
assert.deepEqual(data, context);
});
it('handles missing response object', () => {
const dat = deepclone({ content });
emit(dat, action);
assert.deepEqual(dat.response.body, expectedJSON);
});