Skip to content

Commit

Permalink
test: do not use withCoreProviders method internally
Browse files Browse the repository at this point in the history
This method references providers with the package indentifier that
points to the build folder
  • Loading branch information
thetutlage committed Jan 8, 2024
1 parent 9613852 commit 05d56dd
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 42 deletions.
12 changes: 8 additions & 4 deletions tests/bindings/edge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ test.group('Bindings | Edge', () => {
const ignitor = new IgnitorFactory()
.merge({
rcFileContents: {
providers: [() => import('../../providers/edge_provider.js')],
providers: [
() => import('../../providers/app_provider.js'),
() => import('../../providers/edge_provider.js'),
],
},
})
.withCoreProviders()
.withCoreConfig()
.create(BASE_URL)

Expand All @@ -49,10 +51,12 @@ test.group('Bindings | Edge', () => {
const ignitor = new IgnitorFactory()
.merge({
rcFileContents: {
providers: [() => import('../../providers/edge_provider.js')],
providers: [
() => import('../../providers/app_provider.js'),
() => import('../../providers/edge_provider.js'),
],
},
})
.withCoreProviders()
.withCoreConfig()
.create(BASE_URL)

Expand Down
99 changes: 88 additions & 11 deletions tests/cli_formatters/routes_list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ async function registerRoutes(app: ApplicationService) {

test.group('Formatters | List routes | toJSON', () => {
test('format routes as JSON', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -231,7 +238,14 @@ test.group('Formatters | List routes | toJSON', () => {
})

test('show HEAD routes', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -368,7 +382,14 @@ test.group('Formatters | List routes | toJSON', () => {
})

test('format routes as ANSI list', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -416,7 +437,14 @@ test.group('Formatters | List routes | toJSON', () => {
})

test('format routes as ANSI table', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -482,7 +510,14 @@ test.group('Formatters | List routes | toJSON', () => {

test.group('Formatters | List routes | filters', () => {
test('show routes that has one or more middleware', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -546,7 +581,14 @@ test.group('Formatters | List routes | filters', () => {
})

test('show routes that has zero middleware', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -653,7 +695,14 @@ test.group('Formatters | List routes | filters', () => {
})

test('show routes that has specific middleware', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -706,7 +755,14 @@ test.group('Formatters | List routes | filters', () => {
})

test('combine middleware and ignoreMiddleware filters', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -749,7 +805,14 @@ test.group('Formatters | List routes | filters', () => {
})

test('show routes by controller name', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -792,7 +855,14 @@ test.group('Formatters | List routes | filters', () => {
})

test('show routes by route name', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down Expand Up @@ -846,7 +916,14 @@ test.group('Formatters | List routes | filters', () => {
})

test('show routes by pattern name', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreConfig().withCoreProviders().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.create(fs.baseUrl)

const app = ignitor.createApp('console')
await app.init()
Expand Down
17 changes: 12 additions & 5 deletions tests/commands/make_test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { IgnitorFactory } from '../../factories/core/ignitor.js'
test.group('Make test', () => {
test('--suite flag: make inside suite directory', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory()
.withCoreProviders()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
tests: {
suites: [
{
Expand Down Expand Up @@ -55,7 +55,14 @@ test.group('Make test', () => {
})

test('--suite flag: show error when mentioned suite does not exists', async ({ assert, fs }) => {
const ignitor = new IgnitorFactory().withCoreProviders().withCoreConfig().create(fs.baseUrl)
const ignitor = new IgnitorFactory()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
},
})
.withCoreConfig()
.create(fs.baseUrl)

const ace = await new AceFactory().make(ignitor)
ace.ui.switchMode('raw')
Expand All @@ -77,10 +84,10 @@ test.group('Make test', () => {
fs,
}) => {
const ignitor = new IgnitorFactory()
.withCoreProviders()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
tests: {
suites: [
{
Expand Down Expand Up @@ -120,10 +127,10 @@ test.group('Make test', () => {
fs,
}) => {
const ignitor = new IgnitorFactory()
.withCoreProviders()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
tests: {
suites: [
{
Expand Down Expand Up @@ -173,10 +180,10 @@ test.group('Make test', () => {
fs,
}) => {
const ignitor = new IgnitorFactory()
.withCoreProviders()
.withCoreConfig()
.merge({
rcFileContents: {
providers: [() => import('../../providers/app_provider.js')],
tests: {
suites: [
{
Expand Down
7 changes: 6 additions & 1 deletion tests/hash.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ test.group('Hash | defineConfig', () => {
test.group('Hash | provider', () => {
test('create instance of drivers registered in config file', async ({ assert }) => {
const ignitor = new IgnitorFactory()
.withCoreProviders()
.merge({
config: {
hash: defineConfig({
Expand All @@ -96,6 +95,12 @@ test.group('Hash | provider', () => {
},
}),
},
rcFileContents: {
providers: [
() => import('../providers/app_provider.js'),
() => import('../providers/hash_provider.js'),
],
},
})
.create(BASE_URL)

Expand Down
Loading

0 comments on commit 05d56dd

Please sign in to comment.