mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
completed history tests
This commit is contained in:
@@ -10,32 +10,43 @@ 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: 10,
|
||||||
pageTotal: 1,
|
_links: {
|
||||||
_embedded: {
|
self: {
|
||||||
changesets: [
|
href: "/repositories/scmadmin/TestRepo/history/file?page=0&pageSize=10"
|
||||||
{
|
},
|
||||||
id: "1234"
|
first: {
|
||||||
},
|
href: "/repositories/scmadmin/TestRepo/history/file?page=0&pageSize=10"
|
||||||
{
|
},
|
||||||
id: "2345"
|
next: {
|
||||||
}
|
href: "/repositories/scmadmin/TestRepo/history/file?page=1&pageSize=10"
|
||||||
]
|
},
|
||||||
|
last: {
|
||||||
|
href: "/repositories/scmadmin/TestRepo/history/file?page=9&pageSize=10"
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
_embedded: {
|
||||||
getHistory(FILE_URL).then(content => {
|
changesets: [
|
||||||
expect(content.changesets).toEqual([
|
|
||||||
{
|
{
|
||||||
id: "1234"
|
id: "1234"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "2345"
|
id: "2345"
|
||||||
}
|
}
|
||||||
]);
|
]
|
||||||
expect(content.pageCollection.page).toEqual(0);
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user