This commit is contained in:
Tom Moor
2020-12-28 20:43:27 -08:00
parent caee7afde2
commit 41be18e938
4 changed files with 39 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import app from "../app";
import { Collection, CollectionUser, CollectionGroup } from "../models";
import { buildUser, buildGroup, buildCollection } from "../test/factories";
import { flushdb, seed } from "../test/support";
const server = new TestServer(app.callback());
beforeEach(() => flushdb());
@@ -104,6 +105,26 @@ describe("#collections.list", () => {
});
});
describe("#collections.import", () => {
it("should error if no file is passed", async () => {
const user = await buildUser();
const res = await server.post("/api/collections.import", {
body: {
token: user.getJwtToken(),
},
});
expect(res.status).toEqual(400);
});
it("should require authentication", async () => {
const res = await server.post("/api/collections.import");
const body = await res.json();
expect(res.status).toEqual(401);
expect(body).toMatchSnapshot();
});
});
describe("#collections.export", () => {
it("should now allow export of private collection not a member", async () => {
const { user } = await seed();