kap-plugin-test

v0.5.0
Test your Kap plugins
kap plugin testing test

kap-plugin-test Build Status

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

License

MIT © Sam Verschueren

npm i kap-plugin-test

Metadata

  • MIT
  • Whatever
  • Sam Verschueren
  • released 6/7/2017

Downloads

Maintainers