2
0

📦 Update cuid to cuid2

This commit is contained in:
Baptiste Arnaud
2023-02-10 15:06:02 +01:00
parent 2dbf0fb848
commit 51f76700b2
77 changed files with 254 additions and 250 deletions

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { parse } from 'papaparse'
import { readFileSync } from 'fs'
import { isDefined } from 'utils'
@ -15,7 +15,7 @@ import { Plan } from 'db'
const THREE_GIGABYTES = 3 * 1024 * 1024 * 1024
test('should work as expected', async ({ page, browser }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
publicId: `${typebotId}-public`,
@ -79,8 +79,8 @@ test('should work as expected', async ({ page, browser }) => {
})
test.describe('Storage limit is reached', () => {
const typebotId = cuid()
const workspaceId = cuid()
const typebotId = createId()
const workspaceId = createId()
test.beforeAll(async () => {
await createWorkspaces([{ id: workspaceId, plan: Plan.STARTER }])

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { parse } from 'papaparse'
import { readFileSync } from 'fs'
import { isDefined } from 'utils'
@ -14,7 +14,7 @@ import { Plan } from 'db'
const THREE_GIGABYTES = 3 * 1024 * 1024 * 1024
test('should work as expected', async ({ page, browser }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
publicId: `${typebotId}-public`,
@ -76,8 +76,8 @@ test('should work as expected', async ({ page, browser }) => {
})
test.describe('Storage limit is reached', () => {
const typebotId = cuid()
const workspaceId = cuid()
const typebotId = createId()
const workspaceId = createId()
test.beforeAll(async () => {
await createWorkspaces([{ id: workspaceId, plan: Plan.STARTER }])

View File

@ -1,11 +1,11 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultChatwootOptions, IntegrationBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
const typebotId = cuid()
const typebotId = createId()
const chatwootTestWebsiteToken = 'tueXiiqEmrWUCZ4NUyoR7nhE'

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultChatwootOptions, IntegrationBlockType } from 'models'
const typebotId = cuid()
const typebotId = createId()
const chatwootTestWebsiteToken = 'tueXiiqEmrWUCZ4NUyoR7nhE'

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test'
import { createSmtpCredentials } from '../../../../test/utils/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { SmtpCredentialsData } from 'models'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { typebotViewer } from 'utils/playwright/testHelpers'
@ -27,7 +27,7 @@ test.beforeAll(async () => {
})
test('should send an email', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/sendEmail.json'), {
id: typebotId,
publicId: `${typebotId}-public`,

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test'
import { createSmtpCredentials } from '../../../../test/utils/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { SmtpCredentialsData } from 'models'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { getTestAsset } from '@/test/utils/playwright'
@ -26,7 +26,7 @@ test.beforeAll(async () => {
})
test('should send an email', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/sendEmail.json'), {
id: typebotId,
publicId: `${typebotId}-public`,

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { HttpMethod, Typebot } from 'models'
import {
createWebhook,
@ -12,7 +12,7 @@ import { apiToken } from 'utils/playwright/databaseSetup'
import { getTestAsset } from '@/test/utils/playwright'
test.describe('Bot', () => {
const typebotId = cuid()
const typebotId = createId()
test.beforeEach(async () => {
await importTypebotInDatabase(getTestAsset('typebots/webhook.json'), {

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { HttpMethod } from 'models'
import {
createWebhook,
@ -9,7 +9,7 @@ import {
} from 'utils/playwright/databaseActions'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.beforeEach(async () => {
await importTypebotInDatabase(getTestAsset('typebots/webhook.json'), {

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import prisma from '@/lib/prisma'
import { HttpMethod, SendMessageInput } from 'models'
import {
@ -16,7 +16,7 @@ test.afterEach(async () => {
})
test('API chat execution should work on preview bot', async ({ request }) => {
const typebotId = cuid()
const typebotId = createId()
const publicId = `${typebotId}-public`
await importTypebotInDatabase(getTestAsset('typebots/chat/main.json'), {
id: typebotId,
@ -52,7 +52,7 @@ test('API chat execution should work on preview bot', async ({ request }) => {
})
test('API chat execution should work on published bot', async ({ request }) => {
const typebotId = cuid()
const typebotId = createId()
const publicId = `${typebotId}-public`
await importTypebotInDatabase(getTestAsset('typebots/chat/main.json'), {
id: typebotId,

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
importTypebotInDatabase,
injectFakeResults,
@ -9,7 +9,7 @@ import { apiToken } from 'utils/playwright/databaseSetup'
import { typebotViewer } from 'utils/playwright/testHelpers'
test('Big groups should work as expected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/hugeGroup.json'), {
id: typebotId,
publicId: `${typebotId}-public`,
@ -32,7 +32,7 @@ test('Big groups should work as expected', async ({ page }) => {
})
test('can list results with API', async ({ request }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/api.json'), {
id: typebotId,
})

View File

@ -1,10 +1,10 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
test('Big groups should work as expected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/hugeGroup.json'), {
id: typebotId,
publicId: `${typebotId}-public`,

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
defaultSettings,
defaultTextInputOptions,
@ -11,7 +11,7 @@ import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { typebotViewer } from 'utils/playwright/testHelpers'
test('Result should be in storage by default', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -37,7 +37,7 @@ test('Result should be in storage by default', async ({ page }) => {
test.describe('Create result on page refresh enabled', () => {
test('should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -80,7 +80,7 @@ test.describe('Create result on page refresh enabled', () => {
})
test('Hide query params', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -108,7 +108,7 @@ test('Hide query params', async ({ page }) => {
})
test('Show close message', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -124,7 +124,7 @@ test('Show close message', async ({ page }) => {
})
test('Should correctly parse metadata', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
const googleTagManagerId = 'GTM-M72NXKB'
const customMetadata: Metadata = {
description: 'My custom description',

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
defaultSettings,
defaultTextInputOptions,
@ -10,7 +10,7 @@ import { createTypebots, updateTypebot } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
test('Result should be overwritten on page refresh', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -39,7 +39,7 @@ test('Result should be overwritten on page refresh', async ({ page }) => {
test.describe('Create result on page refresh enabled', () => {
test('should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -74,7 +74,7 @@ test.describe('Create result on page refresh enabled', () => {
})
test('Hide query params', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -102,7 +102,7 @@ test('Hide query params', async ({ page }) => {
})
test('Show close message', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -118,7 +118,7 @@ test('Show close message', async ({ page }) => {
})
test('Should correctly parse metadata', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
const customMetadata: Metadata = {
description: 'My custom description',
title: 'Custom title',

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Plan } from 'db'
import { defaultSettings } from 'models'
import {
@ -12,8 +12,8 @@ import { typebotViewer } from 'utils/playwright/testHelpers'
test('should not start if chat limit is reached', async ({ page, context }) => {
await test.step('Free plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.FREE }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -28,8 +28,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Lifetime plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.LIFETIME }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -44,8 +44,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Custom plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([
{ id: workspaceId, plan: Plan.CUSTOM, customChatsLimit: 1000 },
])

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Plan } from 'db'
import { defaultSettings } from 'models'
import {
@ -11,8 +11,8 @@ import {
test('should not start if chat limit is reached', async ({ page, context }) => {
await test.step('Free plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.FREE }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -27,8 +27,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Lifetime plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.LIFETIME }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -41,8 +41,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Custom plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([
{ id: workspaceId, plan: Plan.CUSTOM, customChatsLimit: 1000 },
])

View File

@ -1,11 +1,11 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { typebotViewer } from 'utils/playwright/testHelpers'
test('should correctly be injected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/predefinedVariables.json'),
{ id: typebotId, publicId: `${typebotId}-public` }

View File

@ -1,10 +1,10 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
test('should correctly be injected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/predefinedVariables.json'),
{ id: typebotId, publicId: `${typebotId}-public` }