Files
SCM-Manager/scm-ui/src/repos/sources/containers/history.test.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-11-26 15:56:41 +01:00
//@flow
import fetchMock from "fetch-mock";
import { getHistory } from "./history";
describe("get content type", () => {
const FILE_URL = "/repositories/scmadmin/TestRepo/history/file";
afterEach(() => {
fetchMock.reset();
fetchMock.restore();
});
2018-11-28 10:04:02 +01:00
const history = {
page: 0,
pageTotal: 10,
_links: {
self: {
href: "/repositories/scmadmin/TestRepo/history/file?page=0&pageSize=10"
},
first: {
href: "/repositories/scmadmin/TestRepo/history/file?page=0&pageSize=10"
},
next: {
href: "/repositories/scmadmin/TestRepo/history/file?page=1&pageSize=10"
},
last: {
href: "/repositories/scmadmin/TestRepo/history/file?page=9&pageSize=10"
2018-11-26 16:39:26 +01:00
}
2018-11-28 10:04:02 +01:00
},
_embedded: {
changesets: [
2018-11-26 15:56:41 +01:00
{
id: "1234"
},
{
id: "2345"
}
2018-11-28 10:04:02 +01:00
]
}
};
it("should return history", done => {
fetchMock.get("/api/v2" + FILE_URL, history);
getHistory(FILE_URL).then(content => {
expect(content.changesets).toEqual(history._embedded.changesets);
expect(content.pageCollection.page).toEqual(history.page);
expect(content.pageCollection.pageTotal).toEqual(history.pageTotal);
expect(content.pageCollection._links).toEqual(history._links);
2018-11-26 15:56:41 +01:00
done();
});
});
});