One share link per user, per doc

This commit is contained in:
Tom Moor
2018-05-23 23:09:20 -07:00
parent aeb97ddcae
commit 7eea1a90af
2 changed files with 23 additions and 5 deletions

View File

@@ -70,6 +70,22 @@ describe('#shares.create', async () => {
expect(body.data.documentTitle).toBe(document.title);
});
it('should return existing share link for document and user', async () => {
const { user, document } = await seed();
const share = await buildShare({
documentId: document.id,
teamId: user.teamId,
userId: user.id,
});
const res = await server.post('/api/shares.create', {
body: { token: user.getJwtToken(), id: document.id },
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.id).toBe(share.id);
});
it('should require authentication', async () => {
const { document } = await seed();
const res = await server.post('/api/shares.create', {