⬆️ ✅ 👕 Prepare for release
This commit is contained in:
parent
8dc8431017
commit
ca78f6efdb
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"author": "Luis Blanco <luisblanco1337@gmail.com>",
|
"author": "Luis Blanco <luisblanco1337@gmail.com>",
|
||||||
"name": "addon-tools-raub",
|
"name": "addon-tools-raub",
|
||||||
"version": "0.1.9",
|
"version": "1.0.0",
|
||||||
"description": "Helpers for Node.js addons and dependency packages",
|
"description": "Helpers for Node.js addons and dependency packages",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
@ -28,6 +28,6 @@
|
||||||
"url": "https://github.com/node-3d/addon-tools-raub.git"
|
"url": "https://github.com/node-3d/addon-tools-raub.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nan": "2.10.0"
|
"nan": "~2.10.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
35
test/test.js
35
test/test.js
|
@ -9,7 +9,7 @@ const { stub, spy } = require('sinon');
|
||||||
const tools = require('addon-tools-raub');
|
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 allMethods = ['paths', 'root', 'include', 'mkdir', 'rm', 'cp'];
|
||||||
const ownMethods = allMethods.slice(1);
|
const ownMethods = allMethods.slice(1);
|
||||||
const cmdMethods = allMethods.slice(3);
|
const cmdMethods = allMethods.slice(3);
|
||||||
|
@ -22,14 +22,14 @@ describe('Tools', () => {
|
||||||
let stubbed;
|
let stubbed;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
log = spy();
|
log = spy();
|
||||||
stubbed = stub(console, 'log').callsFake(log)
|
stubbed = stub(console, 'log').callsFake(log);
|
||||||
});
|
});
|
||||||
afterEach(() => stubbed.restore());
|
afterEach(() => stubbed.restore());
|
||||||
|
|
||||||
|
|
||||||
describe('Own Methods', () => {
|
describe('Own Methods', () => {
|
||||||
|
|
||||||
allMethods.forEach(
|
ownMethods.forEach(
|
||||||
m => it(`#${m}() is available`, () => {
|
m => it(`#${m}() is available`, () => {
|
||||||
expect(tools).to.respondTo(m);
|
expect(tools).to.respondTo(m);
|
||||||
})
|
})
|
||||||
|
@ -46,19 +46,19 @@ describe('Tools', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
it(`#root() is correct`, () => {
|
it('#root() is correct', () => {
|
||||||
tools.root();
|
tools.root();
|
||||||
expect(log.getCall(0).args[0]).to.equal(toolsDir);
|
expect(log.getCall(0).args[0]).to.equal(toolsDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it(`#include() is correct`, async () => {
|
it('#include() is correct', async () => {
|
||||||
|
|
||||||
tools.include();
|
tools.include();
|
||||||
const dirs = log.getCall(0).args[0].split(' ');
|
const dirs = log.getCall(0).args[0].split(' ');
|
||||||
|
|
||||||
const stats = await Promise.all(dirs.map(dir => new Promise(
|
const stats = await Promise.all(dirs.map(dir => new Promise(
|
||||||
(res, rej) => fs.stat(
|
res => fs.stat(
|
||||||
dir,
|
dir,
|
||||||
(err, stat) => err ? res(false) : res(stat.isDirectory())
|
(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', () => {
|
describe('Paths', () => {
|
||||||
|
|
||||||
it(`#paths() returns an object`, () => {
|
it('#paths() returns an object', () => {
|
||||||
expect(tools.paths(__dirname)).to.be.an('object');
|
expect(tools.paths(__dirname)).to.be.an('object');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue