2018-10-15 16:45:54 +02:00
|
|
|
//@flow
|
|
|
|
|
import fetchMock from "fetch-mock";
|
|
|
|
|
import { getContentType } from "./Content";
|
|
|
|
|
|
|
|
|
|
describe("get content type", () => {
|
|
|
|
|
const CONTENT_URL = "/repositories/scmadmin/TestRepo/content/testContent";
|
|
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
|
fetchMock.reset();
|
|
|
|
|
fetchMock.restore();
|
|
|
|
|
});
|
|
|
|
|
|
2018-10-25 11:27:31 +02:00
|
|
|
it("should return content", done => {
|
|
|
|
|
let headers = {
|
2018-10-29 15:57:31 +01:00
|
|
|
"Content-Type": "application/text",
|
|
|
|
|
"X-Programming-Language": "JAVA"
|
2018-10-25 11:27:31 +02:00
|
|
|
};
|
|
|
|
|
|
2018-10-15 16:45:54 +02:00
|
|
|
fetchMock.head("/api/v2" + CONTENT_URL, {
|
2018-10-25 11:27:31 +02:00
|
|
|
headers
|
2018-10-15 16:45:54 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
getContentType(CONTENT_URL).then(content => {
|
2018-10-29 11:50:55 +01:00
|
|
|
expect(content.type).toBe("application/text");
|
2018-10-29 15:57:31 +01:00
|
|
|
expect(content.language).toBe("JAVA");
|
2018-10-15 16:45:54 +02:00
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|