Skip to content

Commit

Permalink
cli: Reduce test execution time
Browse files Browse the repository at this point in the history
- Use Sequelize models to seed DB instead of CLI commands
- Modularize seed scripts: one for each module
  • Loading branch information
fordN committed Jan 24, 2024
1 parent 244c23e commit 3c478d2
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 145 deletions.
4 changes: 3 additions & 1 deletion packages/indexer-cli/src/__tests__/indexer/actions.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { cliTest, setup, teardown } from '../util'
import { cliTest, deleteFromAllTables, seedActions, setup, teardown } from '../util'
import path from 'path'

const baseDir = path.join(__dirname, '..')
describe('Indexer actions tests', () => {
describe('With indexer management server', () => {
beforeAll(setup)
afterAll(teardown)
beforeEach(seedActions)
afterEach(deleteFromAllTables)
describe('Actions help', () => {
cliTest('Indexer actions', ['indexer', 'actions'], 'references/indexer-actions', {
expectedExitCode: 255,
Expand Down
15 changes: 10 additions & 5 deletions packages/indexer-cli/src/__tests__/indexer/cost.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { cliTest, setup, seed, teardown, connect, deleteFromAllTables } from '../util'
import {
cliTest,
setup,
teardown,
connect,
deleteFromAllTables,
seedCostModels,
} from '../util'
import path from 'path'

const baseDir = path.join(__dirname, '..')
Expand All @@ -7,7 +14,7 @@ describe('Indexer cost tests', () => {
describe('With indexer management server', () => {
beforeAll(setup)
afterAll(teardown)
beforeEach(seed)
beforeEach(seedCostModels)
afterEach(deleteFromAllTables)
describe('Cost help', () => {
cliTest('Indexer cost', ['indexer', 'cost'], 'references/indexer-cost', {
Expand Down Expand Up @@ -184,9 +191,7 @@ describe('Indexer cost tests', () => {
})

describe('Without indexer management server', () => {
beforeAll(async () => {
await connect()
})
beforeAll(connect)
cliTest(
'Indexer cost set - not connected',
[
Expand Down
11 changes: 9 additions & 2 deletions packages/indexer-cli/src/__tests__/indexer/rules.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { cliTest, connect, setup, seed, teardown, deleteFromAllTables } from '../util'
import {
cliTest,
connect,
setup,
teardown,
deleteFromAllTables,
seedIndexingRules,
} from '../util'
import path from 'path'

const baseDir = path.join(__dirname, '..')
Expand All @@ -7,7 +14,7 @@ describe('Indexer rules tests', () => {
describe('With indexer management server', () => {
beforeAll(setup)
afterAll(teardown)
beforeEach(seed)
beforeEach(seedIndexingRules)
afterEach(deleteFromAllTables)
describe('Rules help', () => {
cliTest(
Expand Down
Loading

0 comments on commit 3c478d2

Please sign in to comment.