Options
All
  • Public
  • Public/Protected
  • All
Menu

@balena/jellyfish-test-harness

Notice: This utility has been discontinued. Test utilities are now provided by the same modules that provide the functionality. See the test utilities exported by jellyfish-core and jellyfish-worker.

Jellyfish Test Harness

Test harness helpers for Jellyfish repos.

Usage

Below are examples on how to use this library:

Sync integration translate tests

Below is an overview of how to call the scenario runner to execute translate tests. Real world examples can be found in many Jellyfish plugins as well.

import { syncIntegrationScenario } from '@balena/jellyfish-test-harness';
import webhooks from './webhooks/my-integration-name';

syncIntegrationScenario.run(
{
test,
before: beforeAll,
beforeEach,
after: afterAll,
afterEach,
}, {
// The directory in which your sync integration test and webhooks directory are located
basePath: __dirname,

// Optional additional test hooks
before: (test) => {},
beforeEach: (test) => {},
after: (test) => {},
afterEach: (test) => {},

// An optional method to be called to prepare card data before inserting it
prepareEvent: (event: any) => { return event },

// Additional options to pass to the webhook scenario runner
options: {},

// A list of plugin classes required to run the tests
plugins: [],

// A list of card slugs that must be loaded before running any tests
cards: [ ... ],

// The scenarios that will be run
scenarios: webhooks,

// The URL of the integration
baseUrl: 'https://<my-integration-endpoint>',

// The regular expression picking paths on the baseUrl to provide mock responses to
stubRegex: /.*/,

// The slug of the integration under test
source: '<my-integration>',

// A callback to verify if a request is authorized
isAuthorized: (request) => {
...
},
},
);

Documentation

Writing translate tests

Publish Documentation

Visit the website for complete documentation: https://product-os.github.io/jellyfish-test-harness

Generated using TypeDoc