Skip to content

Commit

Permalink
test: simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jan 9, 2024
1 parent 60a9868 commit 0cfc07f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion tests/define_config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/i18n_manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
22 changes: 4 additions & 18 deletions tests/i18n_provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -98,9 +88,7 @@ test.group('I18n Provider', () => {
],
},
})
.create(BASE_URL, {
importer: IMPORTER,
})
.create(BASE_URL)

const app = ignitor.createApp('web')
await app.init()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 0cfc07f

Please sign in to comment.