From f79e26dcd6a86d1300a35f43b8daa8f6aad366b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6nnemann?= Date: Sun, 14 Jun 2015 18:40:44 -0700 Subject: [PATCH] test(type): initial suite --- test/specs/type.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 test/specs/type.js diff --git a/test/specs/type.js b/test/specs/type.js new file mode 100644 index 00000000..c3eb8e13 --- /dev/null +++ b/test/specs/type.js @@ -0,0 +1,44 @@ +const test = require('tap').test + +const type = require('../../dist/lib/type.js') + +test('get type from commits', (t) => { + t.test('get type from plugin', (t) => { + type({ + analyze: () => 'major' + }, { + commits: [{ + hash: '0', + message: 'a' + }], + lastRelease: { + version: '1.0.0' + } + }, (err, type) => { + t.error(err) + t.is(type, 'major') + }) + }) + + t.test('error when no changes', (t) => { + type({ + analyze: () => null + }, { + commits: [], + lastRelease: {} + }, (err) => { + t.is(err.code, 'ENOCHANGE') + }) + }) + + t.test('initial version', (t) => { + type({}, { + lastRelease: { + version: null + } + }, (err, type) => { + t.error(err) + t.is(type, 'initial') + }) + }) +})