Model controllers added

This commit is contained in:
Kiss Dávid
2025-07-28 13:00:46 +02:00
parent 590adb271d
commit 465613f6a0
17 changed files with 470 additions and 100 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ import type { Config } from '@japa/runner/types'
import { pluginAdonisJS } from '@japa/plugin-adonisjs'
import testUtils from '@adonisjs/core/services/test_utils'
/**
* This file is imported by the "bin/test.ts" entrypoint file
*/
@@ -13,7 +14,12 @@ import testUtils from '@adonisjs/core/services/test_utils'
* Configure Japa plugins in the plugins array.
* Learn more - https://japa.dev/docs/runner-config#plugins-optional
*/
export const plugins: Config['plugins'] = [assert(), apiClient(), pluginAdonisJS(app)]
export const plugins: Config['plugins'] = [
assert(),
apiClient({
baseURL: 'http://localhost:3333',
}),
pluginAdonisJS(app)]
/**
* Configure lifecycle function to run before and after all the
@@ -0,0 +1,21 @@
import { test } from '@japa/runner'
test.group('Restaurant menu items', () => {
test('create', async ({ assert, client }) => {
const item = {
name: 'test',
priceSmall: 10,
priceLarge: 20,
description: 'test'
}
const response = await client.post('/api/menu-items/create').json(item)
assert.equal(response.body().name, item.name)
assert.equal(response.body().priceSmall, item.priceSmall)
assert.equal(response.body().priceLarge, item.priceLarge)
assert.equal(response.body().description, item.description)
}),
test('get all', async ({ assert, client }) => {
const response = await client.get('/api/menu-items')
assert.isArray(response.body())
})
})