mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
1ada95e04a
- Convert project to Javascript/Typescript - Allow custom headers to be passed in (optional) - Allow body to be optional
57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
var path = require('path');
|
|
var test = require('tape');
|
|
var resolve = require('../');
|
|
|
|
test('moduleDirectory strings', function (t) {
|
|
t.plan(4);
|
|
var dir = path.join(__dirname, 'module_dir');
|
|
var xopts = {
|
|
basedir: dir,
|
|
moduleDirectory: 'xmodules'
|
|
};
|
|
resolve('aaa', xopts, function (err, res, pkg) {
|
|
t.ifError(err);
|
|
t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
|
|
});
|
|
|
|
var yopts = {
|
|
basedir: dir,
|
|
moduleDirectory: 'ymodules'
|
|
};
|
|
resolve('aaa', yopts, function (err, res, pkg) {
|
|
t.ifError(err);
|
|
t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
|
|
});
|
|
});
|
|
|
|
test('moduleDirectory array', function (t) {
|
|
t.plan(6);
|
|
var dir = path.join(__dirname, 'module_dir');
|
|
var aopts = {
|
|
basedir: dir,
|
|
moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
|
|
};
|
|
resolve('aaa', aopts, function (err, res, pkg) {
|
|
t.ifError(err);
|
|
t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
|
|
});
|
|
|
|
var bopts = {
|
|
basedir: dir,
|
|
moduleDirectory: ['zmodules', 'ymodules', 'xmodules']
|
|
};
|
|
resolve('aaa', bopts, function (err, res, pkg) {
|
|
t.ifError(err);
|
|
t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
|
|
});
|
|
|
|
var copts = {
|
|
basedir: dir,
|
|
moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
|
|
};
|
|
resolve('bbb', copts, function (err, res, pkg) {
|
|
t.ifError(err);
|
|
t.equal(res, path.join(dir, '/zmodules/bbb/main.js'));
|
|
});
|
|
});
|