chore: Typescript database models (#2886)

closes #2798
This commit is contained in:
Tom Moor
2022-01-06 18:24:28 -08:00
committed by GitHub
parent d3cbf250e6
commit b20a341f0c
207 changed files with 5624 additions and 5315 deletions

View File

@@ -9,6 +9,7 @@ const app = webService();
const server = new TestServer(app.callback());
beforeEach(() => flushdb());
afterAll(() => server.close());
describe("#shares.list", () => {
it("should only return shares created by user", async () => {
const { user, admin, document } = await seed();
@@ -133,6 +134,7 @@ describe("#shares.list", () => {
expect(body).toMatchSnapshot();
});
});
describe("#shares.create", () => {
it("should allow creating a share record for document", async () => {
const { user, document } = await seed();
@@ -183,7 +185,7 @@ describe("#shares.create", () => {
teamId: user.teamId,
userId: user.id,
});
await share.revoke();
await share.revoke(user.id);
const res = await server.post("/api/shares.create", {
body: {
token: user.getJwtToken(),
@@ -284,6 +286,7 @@ describe("#shares.create", () => {
expect(res.status).toEqual(403);
});
});
describe("#shares.info", () => {
it("should allow reading share by id", async () => {
const { user, document } = await seed();
@@ -375,7 +378,7 @@ describe("#shares.info", () => {
teamId: user.teamId,
userId: user.id,
});
await share.revoke();
await share.revoke(user.id);
const res = await server.post("/api/shares.info", {
body: {
token: user.getJwtToken(),
@@ -551,6 +554,7 @@ describe("#shares.info", () => {
expect(res.status).toEqual(403);
});
});
describe("#shares.update", () => {
it("should allow user to update a share", async () => {
const { user, document } = await seed();
@@ -647,6 +651,7 @@ describe("#shares.update", () => {
expect(res.status).toEqual(403);
});
});
describe("#shares.revoke", () => {
it("should allow author to revoke a share", async () => {
const { user, document } = await seed();