Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centralise how tests initialise Forge app #805

Merged
merged 1 commit into from
Jul 27, 2022
Merged

Conversation

knolleary
Copy link
Member

Fixes #770

Reduces code duplication and ensures all tests are enabled for postgres testing

The basic pattern for tests to follow is:

// Load the common test utils module
const FF_UTIL = require('flowforge-test-utils')

// Initialise the app with whatever config is required
const app = await FF_UTIL.setupApp({
    license: '....'
})

The FF_UTIL.setupApp function includes a default app config suitable for most tests. The passed-in configuration augments (rather than replaces) that default config.

It also contains the logic to insert the postgres db config if the appropriate env vars are set to enable postgres testing.

Fixes #770

Reduces code duplication and ensures all tests are enabled for
postgres testing
@knolleary
Copy link
Member Author

As of this PR, the default test configuration is:

{
        telemetry: { enabled: false },
        logging: {
            level: 'warn'
        },
        db: {
            type: 'sqlite',
            storage: ':memory:'
        },
        email: {
            enabled: true,
            transport: new LocalTransport()
        },
        driver: {
            type: 'stub'
        },
        broker: {
            url: ':test:'
        }
}

@knolleary knolleary requested a review from hardillb July 26, 2022 15:19
@hardillb hardillb merged commit 5c66edb into main Jul 27, 2022
@hardillb hardillb deleted the fix-postgres-coverage branch July 27, 2022 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Postgres test coverage not getting enabled for all tests
2 participants