make some overall QoL improvements
This commit is contained in:
@@ -132,6 +132,37 @@ test("account rename retains ownership and account deletion removes pending file
|
||||
await assert.rejects(fs.access(path.join(s.directory, key)));
|
||||
});
|
||||
|
||||
test("workspace archive restores image bytes for another account", async t => {
|
||||
const s = await setup(t);
|
||||
const bytes = await s.image("png");
|
||||
const image = await (await s.upload(bytes)).json();
|
||||
const chatId = await s.chat();
|
||||
assert.equal((await s.api("/chat", {chatId, message: "What is in this image?", attachments: [image.id]})).status, 200);
|
||||
const exported = await s.api("/exports/workspace/archive");
|
||||
assert.equal(exported.status, 200);
|
||||
assert.match(exported.headers.get("content-disposition"), /workspace-backup\.tar\.gz/);
|
||||
const archive = await exported.blob();
|
||||
const destination = await s.register("destination");
|
||||
const form = () => {
|
||||
const data = new FormData();
|
||||
data.append("archive", archive, "workspace.tar.gz");
|
||||
return data;
|
||||
};
|
||||
const base = new URL("/", exported.url).origin;
|
||||
const preview = await fetch(base + "/imports/workspace/archive/preview", {method: "POST", headers: {Cookie: destination}, body: form()});
|
||||
assert.equal(preview.status, 200);
|
||||
assert.equal((await preview.json()).preview.chats, 1);
|
||||
const imported = await fetch(base + "/imports/workspace/archive", {method: "POST", headers: {Cookie: destination}, body: form()});
|
||||
assert.equal(imported.status, 200);
|
||||
const workspace = await (await s.api("/exports/workspace", null, "GET", destination)).json();
|
||||
const restored = workspace.workspace.chats[0].messages[0].attachments[0];
|
||||
assert.notEqual(restored.id, image.id);
|
||||
const download = await s.api(`/attachments/${restored.id}`, null, "GET", destination);
|
||||
assert.equal(download.status, 200);
|
||||
assert.deepEqual(Buffer.from(await download.arrayBuffer()), bytes);
|
||||
assert.equal((await s.api(`/attachments/${restored.id}`)).status, 404);
|
||||
});
|
||||
|
||||
test("images feed dedicated vision, cache, streamed reasoning, reload and shared branch lifecycle", async t => {
|
||||
const s = await setup(t);
|
||||
const uploads = [];
|
||||
|
||||
Reference in New Issue
Block a user