0.1.0 • Published 3 years ago

arvish-test v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

arvish-test

BuildStatus NPM download total NPM version MIT license PR's Welcome

Test your arvish extensions

This lib is inspired and cloned from alfy-test.

If you're trying to use this lib, please note that API is different from alfy-test.

  • Some environment variables are not supported yet. You could check which envs is supported on here

  • XML scriptfilter not supported.

Install

$ npm install --save-dev arvish-test

Usage

// Note: API is different from 'alfy-test'.
import test from 'ava';
import arvishTest from 'arvish-test';

test('foo', async t => {
	const arvish = arvishTest({
		vars: {
			query: 'foo bar'
		}
	});

	// Below script is replaced with "node index.js foo\\ bar"
	const result = await arvish("node index.js {query}");

	t.deepEqual(result, [
		{
			title: 'foo',
			subtitle: 'bar'
		}
	]);
});

API

arvishTest(options?)

Returns an mock arvish instance.

options

Type: object

version

Type: string\ Default: arvish-test

Arvis version.

env

Type: object\

You can put unsupported environment variables values through env

vars

Type: object\

You can put query or other variables vars

arvish(script)

Returns a Promise that returns the items of the workflow.

script

Type: string

Script to test.

.config

The arvish config instance.

.cache

The arvish cache instance.

Related

  • arvish - Arvis workflow, plugin creator tools