Last active
September 28, 2018 14:38
-
-
Save mk-pmb/5be4e38b95dce39ca0f22d50f43bd357 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nodemjs | |
| // -*- coding: utf-8, tab-width: 2 -*- | |
| import test from 'p-tape'; | |
| import 'p-fatal'; | |
| import pDelay from 'promise-delay'; | |
| function stubAsyncDataSource(x) { return pDelay(200, x); } | |
| test('Import package meta', async (t) => { | |
| t.plan(3); | |
| let meta; | |
| await t.test('can read', async (sub) => { | |
| sub.plan(1); | |
| meta = (await import('../package.json')).default; | |
| sub.equal((meta && typeof meta), 'object'); | |
| }); | |
| await t.test('homepage alive', async (sub) => { | |
| sub.plan(2); | |
| const webRequest = await stubAsyncDataSource(meta.homepage); | |
| sub.equal(webRequest.httpStatus, 200); | |
| sub.equal(webRequest.title, meta.name); | |
| }); | |
| await t.test('has no bugs', async (sub) => { | |
| sub.plan(2); | |
| const webRequest = await stubAsyncDataSource(meta.bugs.url); | |
| sub.equal(webRequest.httpStatus, 200); | |
| sub.equal(webRequest.meta.nBugs, 0); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment