chore: Move to prettier standard double quotes (#1309)

This commit is contained in:
Tom Moor
2020-06-20 13:59:15 -07:00
committed by GitHub
parent 2a3b9e2104
commit f43deb7940
444 changed files with 5988 additions and 5977 deletions

View File

@ -1,17 +1,17 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import TestServer from 'fetch-test-server';
import app from '../app';
import { CollectionUser } from '../models';
import { flushdb, seed } from '../test/support';
import { buildUser, buildShare } from '../test/factories';
import TestServer from "fetch-test-server";
import app from "../app";
import { CollectionUser } from "../models";
import { flushdb, seed } from "../test/support";
import { buildUser, buildShare } from "../test/factories";
const server = new TestServer(app.callback());
beforeEach(flushdb);
afterAll(server.close);
describe('#shares.list', async () => {
it('should only return shares created by user', async () => {
describe("#shares.list", async () => {
it("should only return shares created by user", async () => {
const { user, admin, document } = await seed();
await buildShare({
documentId: document.id,
@ -23,7 +23,7 @@ describe('#shares.list', async () => {
teamId: user.teamId,
userId: user.id,
});
const res = await server.post('/api/shares.list', {
const res = await server.post("/api/shares.list", {
body: { token: user.getJwtToken() },
});
const body = await res.json();
@ -34,7 +34,7 @@ describe('#shares.list', async () => {
expect(body.data[0].documentTitle).toBe(document.title);
});
it('should not return revoked shares', async () => {
it("should not return revoked shares", async () => {
const { user, document } = await seed();
const share = await buildShare({
documentId: document.id,
@ -43,7 +43,7 @@ describe('#shares.list', async () => {
});
await share.revoke(user.id);
const res = await server.post('/api/shares.list', {
const res = await server.post("/api/shares.list", {
body: { token: user.getJwtToken() },
});
const body = await res.json();
@ -52,14 +52,14 @@ describe('#shares.list', async () => {
expect(body.data.length).toEqual(0);
});
it('admins should return shares created by all users', async () => {
it("admins should return shares created by all users", async () => {
const { user, admin, document } = await seed();
const share = await buildShare({
documentId: document.id,
teamId: admin.teamId,
userId: user.id,
});
const res = await server.post('/api/shares.list', {
const res = await server.post("/api/shares.list", {
body: { token: admin.getJwtToken() },
});
const body = await res.json();
@ -70,7 +70,7 @@ describe('#shares.list', async () => {
expect(body.data[0].documentTitle).toBe(document.title);
});
it('admins should not return shares in collection not a member of', async () => {
it("admins should not return shares in collection not a member of", async () => {
const { admin, document, collection } = await seed();
await buildShare({
documentId: document.id,
@ -81,7 +81,7 @@ describe('#shares.list', async () => {
collection.private = true;
await collection.save();
const res = await server.post('/api/shares.list', {
const res = await server.post("/api/shares.list", {
body: { token: admin.getJwtToken() },
});
const body = await res.json();
@ -90,8 +90,8 @@ describe('#shares.list', async () => {
expect(body.data.length).toEqual(0);
});
it('should require authentication', async () => {
const res = await server.post('/api/shares.list');
it("should require authentication", async () => {
const res = await server.post("/api/shares.list");
const body = await res.json();
expect(res.status).toEqual(401);
@ -99,10 +99,10 @@ describe('#shares.list', async () => {
});
});
describe('#shares.create', async () => {
it('should allow creating a share record for document', async () => {
describe("#shares.create", async () => {
it("should allow creating a share record for document", async () => {
const { user, document } = await seed();
const res = await server.post('/api/shares.create', {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
const body = await res.json();
@ -111,7 +111,7 @@ describe('#shares.create', async () => {
expect(body.data.documentTitle).toBe(document.title);
});
it('should allow creating a share record for document in read-only collection', async () => {
it("should allow creating a share record for document in read-only collection", async () => {
const { user, document, collection } = await seed();
collection.private = true;
await collection.save();
@ -120,10 +120,10 @@ describe('#shares.create', async () => {
createdById: user.id,
collectionId: collection.id,
userId: user.id,
permission: 'read',
permission: "read",
});
const res = await server.post('/api/shares.create', {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
const body = await res.json();
@ -132,7 +132,7 @@ describe('#shares.create', async () => {
expect(body.data.documentTitle).toBe(document.title);
});
it('should allow creating a share record if link previously revoked', async () => {
it("should allow creating a share record if link previously revoked", async () => {
const { user, document } = await seed();
const share = await buildShare({
documentId: document.id,
@ -140,7 +140,7 @@ describe('#shares.create', async () => {
userId: user.id,
});
await share.revoke();
const res = await server.post('/api/shares.create', {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
const body = await res.json();
@ -150,14 +150,14 @@ describe('#shares.create', async () => {
expect(body.data.documentTitle).toBe(document.title);
});
it('should return existing share link for document and user', async () => {
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', {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
const body = await res.json();
@ -166,18 +166,18 @@ describe('#shares.create', async () => {
expect(body.data.id).toBe(share.id);
});
it('should not allow creating a share record if disabled', async () => {
it("should not allow creating a share record if disabled", async () => {
const { user, document, team } = await seed();
await team.update({ sharing: false });
const res = await server.post('/api/shares.create', {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
expect(res.status).toEqual(403);
});
it('should require authentication', async () => {
it("should require authentication", async () => {
const { document } = await seed();
const res = await server.post('/api/shares.create', {
const res = await server.post("/api/shares.create", {
body: { documentId: document.id },
});
const body = await res.json();
@ -186,18 +186,18 @@ describe('#shares.create', async () => {
expect(body).toMatchSnapshot();
});
it('should require authorization', async () => {
it("should require authorization", async () => {
const { document } = await seed();
const user = await buildUser();
const res = await server.post('/api/shares.create', {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
expect(res.status).toEqual(403);
});
});
describe('#shares.revoke', async () => {
it('should allow author to revoke a share', async () => {
describe("#shares.revoke", async () => {
it("should allow author to revoke a share", async () => {
const { user, document } = await seed();
const share = await buildShare({
documentId: document.id,
@ -205,13 +205,13 @@ describe('#shares.revoke', async () => {
userId: user.id,
});
const res = await server.post('/api/shares.revoke', {
const res = await server.post("/api/shares.revoke", {
body: { token: user.getJwtToken(), id: share.id },
});
expect(res.status).toEqual(200);
});
it('should allow admin to revoke a share', async () => {
it("should allow admin to revoke a share", async () => {
const { user, admin, document } = await seed();
const share = await buildShare({
documentId: document.id,
@ -219,20 +219,20 @@ describe('#shares.revoke', async () => {
userId: user.id,
});
const res = await server.post('/api/shares.revoke', {
const res = await server.post("/api/shares.revoke", {
body: { token: admin.getJwtToken(), id: share.id },
});
expect(res.status).toEqual(200);
});
it('should require authentication', async () => {
it("should require authentication", 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.revoke', {
const res = await server.post("/api/shares.revoke", {
body: { id: share.id },
});
const body = await res.json();
@ -241,10 +241,10 @@ describe('#shares.revoke', async () => {
expect(body).toMatchSnapshot();
});
it('should require authorization', async () => {
it("should require authorization", async () => {
const { document } = await seed();
const user = await buildUser();
const res = await server.post('/api/shares.create', {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
expect(res.status).toEqual(403);