-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.test.ts
30 lines (24 loc) · 1.05 KB
/
configure.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { fileURLToPath } from 'node:url';
import Configure from '@adonisjs/core/commands/configure';
import { test } from '@japa/runner';
import { BASE_URL } from '../bin/test.js';
import { createApp } from './test-utils/app.js';
test.group('Configure', (group) => {
group.each.setup(({ context }) => {
context.fs.baseUrl = BASE_URL;
context.fs.basePath = fileURLToPath(BASE_URL);
});
test('Registers provider', async ({ fs, assert }) => {
const app = await createApp();
await fs.create('.env', '');
await fs.createJson('tsconfig.json', {});
await fs.create('start/env.ts', `export default Env.create(new URL('./'), {})`);
await fs.create('adonisrc.ts', 'export default defineConfig({})');
const ace = await app.container.make('ace');
// Path to the file that exports the configure hook. Is relative to BASE_URL
const command = await ace.create(Configure, ['../src/index.js']);
await command.exec();
await assert.fileExists('adonisrc.ts');
await assert.fileContains('adonisrc.ts', 'adonis-openapi/openapi_provider');
}).disableTimeout();
});