chore: Move to prettier standard double quotes (#1309)
This commit is contained in:
@@ -9,8 +9,8 @@ import {
|
||||
Group,
|
||||
GroupUser,
|
||||
Attachment,
|
||||
} from '../models';
|
||||
import uuid from 'uuid';
|
||||
} from "../models";
|
||||
import uuid from "uuid";
|
||||
|
||||
let count = 0;
|
||||
|
||||
@@ -39,8 +39,8 @@ export function buildTeam(overrides: Object = {}) {
|
||||
|
||||
export function buildEvent(overrides: Object = {}) {
|
||||
return Event.create({
|
||||
name: 'documents.publish',
|
||||
ip: '127.0.0.1',
|
||||
name: "documents.publish",
|
||||
ip: "127.0.0.1",
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
@@ -57,10 +57,10 @@ export async function buildUser(overrides: Object = {}) {
|
||||
email: `user${count}@example.com`,
|
||||
username: `user${count}`,
|
||||
name: `User ${count}`,
|
||||
service: 'slack',
|
||||
service: "slack",
|
||||
serviceId: uuid.v4(),
|
||||
createdAt: new Date('2018-01-01T00:00:00.000Z'),
|
||||
lastActiveAt: new Date('2018-01-01T00:00:00.000Z'),
|
||||
createdAt: new Date("2018-01-01T00:00:00.000Z"),
|
||||
lastActiveAt: new Date("2018-01-01T00:00:00.000Z"),
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
@@ -80,9 +80,9 @@ export async function buildCollection(overrides: Object = {}) {
|
||||
|
||||
return Collection.create({
|
||||
name: `Test Collection ${count}`,
|
||||
description: 'Test collection description',
|
||||
description: "Test collection description",
|
||||
creatorId: overrides.userId,
|
||||
type: 'atlas',
|
||||
type: "atlas",
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
@@ -146,7 +146,7 @@ export async function buildDocument(overrides: Object = {}) {
|
||||
|
||||
return Document.create({
|
||||
title: `Document ${count}`,
|
||||
text: 'This is the text in an example document',
|
||||
text: "This is the text in an example document",
|
||||
publishedAt: new Date(),
|
||||
lastModifiedById: overrides.userId,
|
||||
createdById: overrides.userId,
|
||||
@@ -180,11 +180,11 @@ export async function buildAttachment(overrides: Object = {}) {
|
||||
return Attachment.create({
|
||||
key: `uploads/key/to/file ${count}.png`,
|
||||
url: `https://redirect.url.com/uploads/key/to/file ${count}.png`,
|
||||
contentType: 'image/png',
|
||||
contentType: "image/png",
|
||||
size: 100,
|
||||
acl: 'public-read',
|
||||
createdAt: new Date('2018-01-02T00:00:00.000Z'),
|
||||
updatedAt: new Date('2018-01-02T00:00:00.000Z'),
|
||||
acl: "public-read",
|
||||
createdAt: new Date("2018-01-02T00:00:00.000Z"),
|
||||
updatedAt: new Date("2018-01-02T00:00:00.000Z"),
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
// @flow
|
||||
/* global jest */
|
||||
require('dotenv').config({ silent: true });
|
||||
require("dotenv").config({ silent: true });
|
||||
|
||||
// test environment variables
|
||||
process.env.DATABASE_URL = process.env.DATABASE_URL_TEST;
|
||||
process.env.NODE_ENV = 'test';
|
||||
process.env.NODE_ENV = "test";
|
||||
|
||||
const Sequelize = require('sequelize');
|
||||
const sequelize = require('../sequelize').sequelize;
|
||||
const Umzug = require('umzug');
|
||||
const Sequelize = require("sequelize");
|
||||
const sequelize = require("../sequelize").sequelize;
|
||||
const Umzug = require("umzug");
|
||||
|
||||
const queryInterface = sequelize.getQueryInterface();
|
||||
|
||||
function runMigrations() {
|
||||
const umzug = new Umzug({
|
||||
storage: 'sequelize',
|
||||
storage: "sequelize",
|
||||
storageOptions: {
|
||||
sequelize,
|
||||
},
|
||||
migrations: {
|
||||
params: [queryInterface, Sequelize],
|
||||
path: './server/migrations',
|
||||
path: "./server/migrations",
|
||||
},
|
||||
});
|
||||
return umzug.up();
|
||||
@@ -30,4 +30,4 @@ runMigrations();
|
||||
|
||||
// This is needed for the relative manual mock to be picked up
|
||||
// $FlowFixMe
|
||||
jest.mock('../events');
|
||||
jest.mock("../events");
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
// @flow
|
||||
import { User, Document, Collection, Team } from '../models';
|
||||
import { sequelize } from '../sequelize';
|
||||
import { User, Document, Collection, Team } from "../models";
|
||||
import { sequelize } from "../sequelize";
|
||||
|
||||
export function flushdb() {
|
||||
const sql = sequelize.getQueryInterface();
|
||||
const tables = Object.keys(sequelize.models).map(model => {
|
||||
const n = sequelize.models[model].getTableName();
|
||||
return sql.quoteTable(typeof n === 'string' ? n : n.tableName);
|
||||
return sql.quoteTable(typeof n === "string" ? n : n.tableName);
|
||||
});
|
||||
|
||||
const query = `TRUNCATE ${tables.join(', ')} CASCADE`;
|
||||
const query = `TRUNCATE ${tables.join(", ")} CASCADE`;
|
||||
return sequelize.query(query);
|
||||
}
|
||||
|
||||
const seed = async () => {
|
||||
const team = await Team.create({
|
||||
id: '86fde1d4-0050-428f-9f0b-0bf77f8bdf61',
|
||||
name: 'Team',
|
||||
slackId: 'T2399UF2P',
|
||||
id: "86fde1d4-0050-428f-9f0b-0bf77f8bdf61",
|
||||
name: "Team",
|
||||
slackId: "T2399UF2P",
|
||||
slackData: {
|
||||
id: 'T2399UF2P',
|
||||
id: "T2399UF2P",
|
||||
},
|
||||
});
|
||||
|
||||
const admin = await User.create({
|
||||
id: 'fa952cff-fa64-4d42-a6ea-6955c9689046',
|
||||
email: 'admin@example.com',
|
||||
username: 'admin',
|
||||
name: 'Admin User',
|
||||
id: "fa952cff-fa64-4d42-a6ea-6955c9689046",
|
||||
email: "admin@example.com",
|
||||
username: "admin",
|
||||
name: "Admin User",
|
||||
teamId: team.id,
|
||||
isAdmin: true,
|
||||
service: 'slack',
|
||||
serviceId: 'U2399UF1P',
|
||||
service: "slack",
|
||||
serviceId: "U2399UF1P",
|
||||
slackData: {
|
||||
id: 'U2399UF1P',
|
||||
image_192: 'http://example.com/avatar.png',
|
||||
id: "U2399UF1P",
|
||||
image_192: "http://example.com/avatar.png",
|
||||
},
|
||||
createdAt: new Date('2018-01-01T00:00:00.000Z'),
|
||||
createdAt: new Date("2018-01-01T00:00:00.000Z"),
|
||||
});
|
||||
|
||||
const user = await User.create({
|
||||
id: '46fde1d4-0050-428f-9f0b-0bf77f4bdf61',
|
||||
email: 'user1@example.com',
|
||||
username: 'user1',
|
||||
name: 'User 1',
|
||||
id: "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
||||
email: "user1@example.com",
|
||||
username: "user1",
|
||||
name: "User 1",
|
||||
teamId: team.id,
|
||||
service: 'slack',
|
||||
serviceId: 'U2399UF2P',
|
||||
service: "slack",
|
||||
serviceId: "U2399UF2P",
|
||||
slackData: {
|
||||
id: 'U2399UF2P',
|
||||
image_192: 'http://example.com/avatar.png',
|
||||
id: "U2399UF2P",
|
||||
image_192: "http://example.com/avatar.png",
|
||||
},
|
||||
createdAt: new Date('2018-01-02T00:00:00.000Z'),
|
||||
createdAt: new Date("2018-01-02T00:00:00.000Z"),
|
||||
});
|
||||
|
||||
const collection = await Collection.create({
|
||||
id: '26fde1d4-0050-428f-9f0b-0bf77f8bdf62',
|
||||
name: 'Collection',
|
||||
urlId: 'collection',
|
||||
id: "26fde1d4-0050-428f-9f0b-0bf77f8bdf62",
|
||||
name: "Collection",
|
||||
urlId: "collection",
|
||||
teamId: team.id,
|
||||
creatorId: user.id,
|
||||
type: 'atlas',
|
||||
type: "atlas",
|
||||
});
|
||||
|
||||
const document = await Document.create({
|
||||
@@ -70,8 +70,8 @@ const seed = async () => {
|
||||
userId: collection.creatorId,
|
||||
lastModifiedById: collection.creatorId,
|
||||
createdById: collection.creatorId,
|
||||
title: 'First ever document',
|
||||
text: '# Much test support',
|
||||
title: "First ever document",
|
||||
text: "# Much test support",
|
||||
});
|
||||
await document.publish();
|
||||
await collection.reload();
|
||||
|
||||
Reference in New Issue
Block a user