import {
  kategories,
  kategorie,
  createKategorie,
  updateKategorie,
  deleteKategorie,
} from './kategories'

// 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('kategories', () => {
  scenario('returns all kategories', async (scenario) => {
    const result = await kategories()

    expect(result.length).toEqual(Object.keys(scenario.kategorie).length)
  })

  scenario('returns a single kategorie', async (scenario) => {
    const result = await kategorie({ id: scenario.kategorie.one.id })

    expect(result).toEqual(scenario.kategorie.one)
  })

  scenario('creates a kategorie', async () => {
    const result = await createKategorie({
      input: { name: 'String2189335' },
    })

    expect(result.name).toEqual('String2189335')
  })

  scenario('updates a kategorie', async (scenario) => {
    const original = await kategorie({
      id: scenario.kategorie.one.id,
    })
    const result = await updateKategorie({
      id: original.id,
      input: { name: 'String81840662' },
    })

    expect(result.name).toEqual('String81840662')
  })

  scenario('deletes a kategorie', async (scenario) => {
    const original = await deleteKategorie({
      id: scenario.kategorie.one.id,
    })
    const result = await kategorie({ id: original.id })

    expect(result).toEqual(null)
  })
})
