From 0cfc07fc5ed99e573738b104f17bf82e387e437c Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Tue, 9 Jan 2024 11:23:09 +0530 Subject: [PATCH] test: simplify tests --- package.json | 4 ++-- tests/define_config.spec.ts | 2 +- tests/i18n_manager.spec.ts | 2 +- tests/i18n_provider.spec.ts | 22 ++++------------------ 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 7d84afa..491bc4d 100644 --- a/package.json +++ b/package.json @@ -76,9 +76,9 @@ "yaml": "^2.3.4" }, "peerDependencies": { - "@adonisjs/core": "^6.1.5-34", + "@adonisjs/core": "^6.2.0", "@vinejs/vine": "^1.7.0", - "edge.js": "^6.0.0" + "edge.js": "^6.0.1" }, "peerDependenciesMeta": { "edge.js": { diff --git a/tests/define_config.spec.ts b/tests/define_config.spec.ts index 9d4a426..6e24942 100644 --- a/tests/define_config.spec.ts +++ b/tests/define_config.spec.ts @@ -16,7 +16,7 @@ import { IcuFormatter } from '../src/messages_formatters/icu.js' import { defineConfig, formatters, loaders } from '../src/define_config.js' const BASE_URL = new URL('./', import.meta.url) -const app = new AppFactory().create(BASE_URL, () => {}) as ApplicationService +const app = new AppFactory().create(BASE_URL) as ApplicationService test.group('Define config', () => { test('throw error when missing formatter', ({ assert }) => { diff --git a/tests/i18n_manager.spec.ts b/tests/i18n_manager.spec.ts index 5464672..5111dda 100644 --- a/tests/i18n_manager.spec.ts +++ b/tests/i18n_manager.spec.ts @@ -19,7 +19,7 @@ import { IcuFormatter } from '../src/messages_formatters/icu.js' import type { MissingTranslationEventPayload } from '../src/types.js' const BASE_URL = new URL('./', import.meta.url) -const app = new AppFactory().create(BASE_URL, () => {}) +const app = new AppFactory().create(BASE_URL) const emitter = new Emitter<{ 'i18n:missing:translation': MissingTranslationEventPayload }>(app) test.group('I18nManager', () => { diff --git a/tests/i18n_provider.spec.ts b/tests/i18n_provider.spec.ts index 50d7e89..5dd279d 100644 --- a/tests/i18n_provider.spec.ts +++ b/tests/i18n_provider.spec.ts @@ -15,12 +15,6 @@ import { I18nManager } from '../src/i18n_manager.js' import { defineConfig, formatters, loaders } from '../src/define_config.js' const BASE_URL = new URL('./tmp/', import.meta.url) -const IMPORTER = (filePath: string) => { - if (filePath.startsWith('./') || filePath.startsWith('../')) { - return import(new URL(filePath, BASE_URL).href) - } - return import(filePath) -} test.group('I18n Provider', () => { test('register i18n provider', async ({ fs, assert }) => { @@ -42,9 +36,7 @@ test.group('I18n Provider', () => { providers: [() => import('../providers/i18n_provider.js')], }, }) - .create(BASE_URL, { - importer: IMPORTER, - }) + .create(BASE_URL) const app = ignitor.createApp('web') await app.init() @@ -64,9 +56,7 @@ test.group('I18n Provider', () => { providers: [() => import('../providers/i18n_provider.js')], }, }) - .create(BASE_URL, { - importer: IMPORTER, - }) + .create(BASE_URL) const app = ignitor.createApp('web') await app.init() @@ -98,9 +88,7 @@ test.group('I18n Provider', () => { ], }, }) - .create(BASE_URL, { - importer: IMPORTER, - }) + .create(BASE_URL) const app = ignitor.createApp('web') await app.init() @@ -134,9 +122,7 @@ test.group('I18n Provider', () => { providers: [() => import('../providers/i18n_provider.js')], }, }) - .create(BASE_URL, { - importer: IMPORTER, - }) + .create(BASE_URL) const app = ignitor.createApp('repl') await app.init()