completed history tests

This commit is contained in:
Maren Süwer
2018-11-28 10:04:02 +01:00
parent 1b41fe8d93
commit 8b3743f39e

View File

@@ -10,10 +10,23 @@ describe("get content type", () => {
fetchMock.restore(); fetchMock.restore();
}); });
it("should return history", done => { const history = {
fetchMock.get("/api/v2" + FILE_URL, {
page: 0, page: 0,
pageTotal: 1, 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"
}
},
_embedded: { _embedded: {
changesets: [ changesets: [
{ {
@@ -24,18 +37,16 @@ describe("get content type", () => {
} }
] ]
} }
}); };
it("should return history", done => {
fetchMock.get("/api/v2" + FILE_URL, history);
getHistory(FILE_URL).then(content => { getHistory(FILE_URL).then(content => {
expect(content.changesets).toEqual([ expect(content.changesets).toEqual(history._embedded.changesets);
{ expect(content.pageCollection.page).toEqual(history.page);
id: "1234" expect(content.pageCollection.pageTotal).toEqual(history.pageTotal);
}, expect(content.pageCollection._links).toEqual(history._links);
{
id: "2345"
}
]);
expect(content.pageCollection.page).toEqual(0);
done(); done();
}); });
}); });