Test your Kap plugins
$ npm install --save-dev kap-plugin-test
import test from 'ava';
import kapPluginTest from 'kap-plugin-test';
test(async t => {
const plugin = kapPluginTest('path/to/input.gif', {
config: {
apiKey: 'a3b78f9ce6'
}
});
plugin.context.request.resolves({url: 'http://gph.is/1TGDci8'})
await plugin.run();
t.true(plugin.context.copyToClipboard.calledWith('http://gph.is/1TGDci8'));
});
Returns a plugin
object.
Type: string
Path to the file that is being processed.
Type: object
Type: number
Default: 0
Index of the service in the shareServices
array that you want to test.
Type: object
Default: plugin defaults
Plugin configuration object.
Type: string
Default: process.cwd()
Location of the plugin.
Run the plugin.
Access the plugin context object. All methods are SinonJS spies, except for request
which is a stub.
- kap-plugin-mock-context - Kap plugin mock context
MIT © Sam Verschueren