|
|
|
@ -97,6 +97,25 @@ describe('Resource', () => {
|
|
|
|
|
}, /content does not appear to be text/i);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('throws an error if the response has no Content-Type header', () => {
|
|
|
|
|
const response = {
|
|
|
|
|
headers: {},
|
|
|
|
|
};
|
|
|
|
|
const body = '';
|
|
|
|
|
|
|
|
|
|
// This assertion is more elaborate than the others to be sure that we're
|
|
|
|
|
// throwing an `Error` and not raising a runtime exception.
|
|
|
|
|
assert.throws(
|
|
|
|
|
() => {
|
|
|
|
|
Resource.generateDoc({ body, response });
|
|
|
|
|
},
|
|
|
|
|
err => (
|
|
|
|
|
(err instanceof Error) &&
|
|
|
|
|
/content does not appear to be text/i.test(err)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('throws an error if the content has no children', () => {
|
|
|
|
|
// jquery's parser won't work this way, and this is
|
|
|
|
|
// an outside case
|
|
|
|
|