2
0

Add e2e tests for account

This commit is contained in:
Baptiste Arnaud
2021-12-28 11:13:09 +01:00
parent e10fe1a186
commit 8c826fcf70
13 changed files with 321 additions and 302 deletions

View File

@ -1,7 +1,55 @@
import { Step, TextStep, StepType, TextInputStep } from '../models'
import { Prisma } from 'db'
import {
Step,
TextStep,
StepType,
TextInputStep,
BackgroundType,
Settings,
StartBlock,
Theme,
} from '../models'
export const isTextStep = (step: Step): step is TextStep =>
step.type === StepType.TEXT
export const isTextInputStep = (step: Step): step is TextInputStep =>
step.type === StepType.TEXT_INPUT
export const parseNewTypebot = ({
ownerId,
folderId,
name,
}: {
ownerId: string
folderId: string | null
name: string
}): Prisma.TypebotUncheckedCreateInput => {
const startBlock: StartBlock = {
id: 'start-block',
title: 'Start',
graphCoordinates: { x: 0, y: 0 },
steps: [
{
id: 'start-step',
blockId: 'start-block',
label: 'Form starts here',
type: StepType.START,
},
],
}
const theme: Theme = {
general: {
font: 'Open Sans',
background: { type: BackgroundType.NONE, content: '#ffffff' },
},
}
const settings: Settings = {
typingEmulation: {
enabled: true,
speed: 300,
maxDelay: 1.5,
},
}
return { folderId, name, ownerId, startBlock, theme, settings }
}