76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
import { Prisma, Nachhilfeangebot } from '@prisma/client'
|
|
|
|
import {
|
|
nachhilfeangebots,
|
|
nachhilfeangebot,
|
|
createNachhilfeangebot,
|
|
updateNachhilfeangebot,
|
|
deleteNachhilfeangebot,
|
|
} from './nachhilfeangebots'
|
|
import type { StandardScenario } from './nachhilfeangebots.scenarios'
|
|
|
|
// Generated boilerplate tests do not account for all circumstances
|
|
// and can fail without adjustments, e.g. Float.
|
|
// Please refer to the RedwoodJS Testing Docs:
|
|
// https://redwoodjs.com/docs/testing#testing-services
|
|
// https://redwoodjs.com/docs/testing#jest-expect-type-considerations
|
|
|
|
describe('nachhilfeangebots', () => {
|
|
scenario(
|
|
'returns all nachhilfeangebots',
|
|
async (scenario: StandardScenario) => {
|
|
const result = await nachhilfeangebots()
|
|
|
|
expect(result.length).toEqual(
|
|
Object.keys(scenario.nachhilfeangebot).length
|
|
)
|
|
}
|
|
)
|
|
|
|
scenario(
|
|
'returns a single nachhilfeangebot',
|
|
async (scenario: StandardScenario) => {
|
|
const result = await nachhilfeangebot({
|
|
id: scenario.nachhilfeangebot.one.id,
|
|
})
|
|
|
|
expect(result).toEqual(scenario.nachhilfeangebot.one)
|
|
}
|
|
)
|
|
|
|
scenario('creates a nachhilfeangebot', async () => {
|
|
const result = await createNachhilfeangebot({
|
|
input: {
|
|
subject: 'String',
|
|
currentClass: 'String',
|
|
cost: 3443924.824820386,
|
|
},
|
|
})
|
|
|
|
expect(result.subject).toEqual('String')
|
|
expect(result.currentClass).toEqual('String')
|
|
expect(result.cost).toEqual(new Prisma.Decimal(3443924.824820386))
|
|
})
|
|
|
|
scenario('updates a nachhilfeangebot', async (scenario: StandardScenario) => {
|
|
const original = (await nachhilfeangebot({
|
|
id: scenario.nachhilfeangebot.one.id,
|
|
})) as Nachhilfeangebot
|
|
const result = await updateNachhilfeangebot({
|
|
id: original.id,
|
|
input: { subject: 'String2' },
|
|
})
|
|
|
|
expect(result.subject).toEqual('String2')
|
|
})
|
|
|
|
scenario('deletes a nachhilfeangebot', async (scenario: StandardScenario) => {
|
|
const original = (await deleteNachhilfeangebot({
|
|
id: scenario.nachhilfeangebot.one.id,
|
|
})) as Nachhilfeangebot
|
|
const result = await nachhilfeangebot({ id: original.id })
|
|
|
|
expect(result).toEqual(null)
|
|
})
|
|
})
|