Skip to content

Commit

Permalink
test pagination for getSceneHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
sdumetz committed Jan 10, 2025
1 parent 5ef56d0 commit 9740dc5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions source/server/vfs/vfs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1221,8 +1221,25 @@ describe("Vfs", function(){
let history = await vfs.getSceneHistory(scene_id);
expect(history).to.have.property("length", 1+ default_folders);
expect(history.find(f=>f.name == "scene.svx.json")).to.have.property("size", Buffer.byteLength(str));
})
it.skip("supports pagination");
});

it("supports pagination", async function(){
for(let i=0; i < 20; i++){
await vfs.writeDoc("{}", {scene: scene_id, user_id: 0, name: "scene.svx.json", mime: "application/si-dpo-3d.document+json"});
}

let history = await vfs.getSceneHistory(scene_id, {limit: 2, offset: 0});
expect(history.map(e=>e.generation)).to.deep.equal([
20,
19,
]);
history = await vfs.getSceneHistory(scene_id, {limit: 2, offset: 2});
expect(history).to.have.property("length", 2);
expect(history.map(e=>e.generation)).to.deep.equal([
18,
17,
]);
});
});

describe("listFiles()", function(){
Expand Down

0 comments on commit 9740dc5

Please sign in to comment.