kap-plugin-test
v0.5.0
Published
Test your Kap plugins
Downloads
49
Readme
kap-plugin-test
Test your Kap plugins
Install
$ npm install --save-dev kap-plugin-test
Usage
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'));
});
API
kapPluginTest(file, [options])
Returns a plugin
object.
file
Type: string
Path to the file that is being processed.
options
Type: object
service
Type: number
Default: 0
Index of the service in the shareServices
array that you want to test.
config
Type: object
Default: plugin defaults
Plugin configuration object.
cwd
Type: string
Default: process.cwd()
Location of the plugin.
plugin
.run()
Run the plugin.
.context
Access the plugin context object. All methods are SinonJS spies, except for request
which is a stub.
Related
- kap-plugin-mock-context - Kap plugin mock context
License
MIT © Sam Verschueren