From c5053842fa094723d40b0ee9561194e1eaf68cc7 Mon Sep 17 00:00:00 2001 From: Bassel Date: Thu, 24 Nov 2022 10:29:59 +0200 Subject: [PATCH] fix formatting --- .../lib/providers/test-utils/index.ts | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/packages/core/data-transfer/lib/providers/test-utils/index.ts b/packages/core/data-transfer/lib/providers/test-utils/index.ts index 6f5ea80a31..69b3cf2718 100644 --- a/packages/core/data-transfer/lib/providers/test-utils/index.ts +++ b/packages/core/data-transfer/lib/providers/test-utils/index.ts @@ -4,15 +4,15 @@ import { Readable } from 'stream'; * Collect every entity in a Readable stream */ export const collect = (stream: Readable): Promise => { - const chunks: T[] = []; + const chunks: T[] = []; - return new Promise((resolve) => { - stream.on('data', (chunk) => chunks.push(chunk)); - stream.on('end', () => { - stream.destroy(); - resolve(chunks); - }); + return new Promise((resolve) => { + stream.on('data', (chunk) => chunks.push(chunk)); + stream.on('end', () => { + stream.destroy(); + resolve(chunks); }); + }); }; /** @@ -20,16 +20,16 @@ export const collect = (stream: Readable): Promise => { * given params and cast it to the correct type */ export const getStrapiFactory = - < - T extends { - [key in keyof Partial]: unknown; - } - >( - properties?: T - ) => - () => { - return { ...properties } as Strapi.Strapi; - }; + < + T extends { + [key in keyof Partial]: unknown; + } + >( + properties?: T + ) => + () => { + return { ...properties } as Strapi.Strapi; + }; /** * Union type used to represent the default content types available @@ -40,38 +40,38 @@ export type ContentType = 'foo' | 'bar'; * Factory to get default content types test values */ export const getContentTypes = (): { - [key in ContentType]: { uid: key; attributes: { [attribute: string]: unknown } }; + [key in ContentType]: { uid: key; attributes: { [attribute: string]: unknown } }; } => ({ - foo: { uid: 'foo', attributes: { title: { type: 'string' } } }, - bar: { uid: 'bar', attributes: { age: { type: 'number' } } }, + foo: { uid: 'foo', attributes: { title: { type: 'string' } } }, + bar: { uid: 'bar', attributes: { age: { type: 'number' } } }, }); /** * Create a factory of readable streams (wrapped with a jest mock function) */ export const createMockedReadableFactory = (source: { - [ct in T]: Array<{ id: number;[key: string]: unknown }>; + [ct in T]: Array<{ id: number; [key: string]: unknown }>; }) => - jest.fn((uid: T) => { - return Readable.from(source[uid] || []); - }); + jest.fn((uid: T) => { + return Readable.from(source[uid] || []); + }); /** * Create a factory of mocked query builders */ export const createMockedQueryBuilder = (data: { - [key in T]: unknown[]; + [key in T]: unknown[]; }) => - jest.fn((uid: T) => { - const state: { [key: string]: unknown } = { populate: undefined }; + jest.fn((uid: T) => { + const state: { [key: string]: unknown } = { populate: undefined }; - return { - populate(populate: unknown) { - state.populate = populate; - return this; - }, - stream() { - return Readable.from(data[uid]); - }, - }; - }); + return { + populate(populate: unknown) { + state.populate = populate; + return this; + }, + stream() { + return Readable.from(data[uid]); + }, + }; + });