⬆️ 👕 Prepare for release

This commit is contained in:
raub 2018-05-05 17:15:16 +03:00
parent 8dc8431017
commit ca78f6efdb
2 changed files with 30 additions and 9 deletions

View File

@ -1,7 +1,7 @@
{
"author": "Luis Blanco <luisblanco1337@gmail.com>",
"name": "addon-tools-raub",
"version": "0.1.9",
"version": "1.0.0",
"description": "Helpers for Node.js addons and dependency packages",
"license": "MIT",
"main": "index.js",
@ -28,6 +28,6 @@
"url": "https://github.com/node-3d/addon-tools-raub.git"
},
"dependencies": {
"nan": "2.10.0"
"nan": "~2.10.0"
}
}

View File

@ -9,7 +9,7 @@ const { stub, spy } = require('sinon');
const tools = require('addon-tools-raub');
const toolsDir = path.dirname(require.resolve('addon-tools-raub')).replace(/\\/g, '/')
const toolsDir = path.dirname(require.resolve('addon-tools-raub')).replace(/\\/g, '/');
const allMethods = ['paths', 'root', 'include', 'mkdir', 'rm', 'cp'];
const ownMethods = allMethods.slice(1);
const cmdMethods = allMethods.slice(3);
@ -22,14 +22,14 @@ describe('Tools', () => {
let stubbed;
beforeEach(() => {
log = spy();
stubbed = stub(console, 'log').callsFake(log)
stubbed = stub(console, 'log').callsFake(log);
});
afterEach(() => stubbed.restore());
describe('Own Methods', () => {
allMethods.forEach(
ownMethods.forEach(
m => it(`#${m}() is available`, () => {
expect(tools).to.respondTo(m);
})
@ -46,19 +46,19 @@ describe('Tools', () => {
);
it(`#root() is correct`, () => {
it('#root() is correct', () => {
tools.root();
expect(log.getCall(0).args[0]).to.equal(toolsDir);
});
it(`#include() is correct`, async () => {
it('#include() is correct', async () => {
tools.include();
const dirs = log.getCall(0).args[0].split(' ');
const stats = await Promise.all(dirs.map(dir => new Promise(
(res, rej) => fs.stat(
res => fs.stat(
dir,
(err, stat) => err ? res(false) : res(stat.isDirectory())
)
@ -71,9 +71,30 @@ describe('Tools', () => {
});
describe('Cmd Methods', () => {
cmdMethods.forEach(
m => it(`#${m}() is available`, () => {
expect(tools).to.respondTo(m);
})
);
cmdMethods.forEach(
m => it(`#${m}() writes stdout`, () => {
tools[m]();
expect(log.getCall(0), 'called').to.exist;
expect(log.getCall(0).args[0], 'has args').to.exist;
expect(log.getCall(0).args[0], 'writes string').to.be.a('string');
})
);
});
describe('Paths', () => {
it(`#paths() returns an object`, () => {
it('#paths() returns an object', () => {
expect(tools.paths(__dirname)).to.be.an('object');
});