test

Unit test manager. Manages tests for actions/reducers and components. Usually used with action/component manager.

Source:

Methods

(static) add(feature, name, argsopt)

Source:

Add the unit test boilerplate file for a component.

Example
const test = require('rekit-core').test;
test.add('home', 'Hello');

// Result => Create the unit test boilerplate file at: 'tests/features/home/Hello.test.js'.
Parameters:
Name Type Attributes Description
feature string

The feature name.

name string

The component name.

args Object <optional>

The args passed to rekit-core/template.

Properties
Name Type Attributes Default Description
templateFile string <optional>
Component.test.js

The template file to create test file.

(static) addAction(feature, name, argsopt)

Source:

Add the unit test boilerplate file for an action (using different templates for sync or async).

Example
const test = require('rekit-core').test;
test.addAction('home', 'doSomething', { isAsync: true });

// Result => Create the unit test boilerplate file at: 'tests/features/home/redux/doSomething.test.js'.
Parameters:
Name Type Attributes Description
feature string

The feature name.

name string

The action name.

args Object <optional>

The args passed to rekit-core/template.

Properties
Name Type Attributes Default Description
templateFile string <optional>
Component.test.js

The template file to create test file.

isAsync string <optional>
false

Whether the action is async.

(static) move(source, target)

Source:

Move/rename the unit test file for a component.

Parameters:
Name Type Description
source ElementArg

Which component test to move.

target ElementArg

The target location of the component test.

(static) moveAction(source, target, argsopt)

Source:

Move/rename the unit test file for an action.

Parameters:
Name Type Attributes Description
source ElementArg

Which action test to move.

target ElementArg

The target location of the action test.

args Object <optional>

Only used to indicates if it's async.

Properties
Name Type Attributes Default Description
isAsync Object <optional>
false

Whether it's an async action.

(static) remove(feature, name)

Source:

Remove the unit test file for a component.

Example
const test = require('rekit-core').test;
test.remove('home', 'Hello');

// Result => Delete the test file of: 'tests/features/home/Hello.test.js'.
Parameters:
Name Type Description
feature string

The feature name.

name string

The component name.

(static) removeAction(feature, name)

Source:

Remove the unit test file for an action (either sync or async).

Parameters:
Name Type Description
feature string

The feature name.

name string

The action name.