From c47ff97ab3980ba276fe535b1dd39e0b7c3720b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6nnemann?= Date: Wed, 17 Jun 2015 15:41:26 -0700 Subject: [PATCH] test(verify): initial suite --- test/specs/verify.js | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/specs/verify.js diff --git a/test/specs/verify.js b/test/specs/verify.js new file mode 100644 index 00000000..731c7812 --- /dev/null +++ b/test/specs/verify.js @@ -0,0 +1,53 @@ +const test = require('tap').test + +const verify = require('../../dist/lib/verify') + +test('verify pkg, options and env', (t) => { + t.test('dry run verification', (tt) => { + const noErrors = verify({ + name: 'package', + repository: { + url: 'http://github.com/whats/up.git' + } + }, { + debug: true + }, {}) + + tt.is(noErrors.length, 0) + + const errors = verify({}, { + debug: true + }, {}) + + tt.is(errors.length, 2) + tt.is(errors[0].code, 'ENOPKGNAME') + tt.is(errors[1].code, 'ENOPKGREPO') + + tt.end() + }) + + t.test('publish verification', (tt) => { + const noErrors = verify({ + name: 'package', + repository: { + url: 'http://github.com/whats/up.git' + } + }, { + 'github-token': 'sup' + }, { + NPM_TOKEN: 'yo' + }) + + tt.is(noErrors.length, 0) + + const errors = verify({}, {}, {}) + + tt.is(errors.length, 4) + tt.is(errors[0].code, 'ENOPKGNAME') + tt.is(errors[1].code, 'ENOPKGREPO') + tt.is(errors[2].code, 'ENOGHTOKEN') + tt.is(errors[3].code, 'ENONPMTOKEN') + + tt.end() + }) +})