From 0dc95e938e26a4687dd53103b44a84ce1ac92799 Mon Sep 17 00:00:00 2001 From: Evheniy Bystrov Date: Mon, 13 Feb 2017 06:42:56 +0000 Subject: [PATCH] new test --- README.md | 2 -- appveyor.yml | 3 ++- package.json | 3 ++- tests/index.js | 26 ++++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9522f04..21a7654 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ Simple promised node http request-response handler [![NPM](https://nodei.co/npm/yeps.png)](https://npmjs.org/package/yeps) [![npm version](https://badge.fury.io/js/yeps.svg)](https://badge.fury.io/js/yeps) -[![NPM Downloads](https://img.shields.io/npm/evheniy/yeps.svg)](https://npmjs.org/package/yeps) - [![Build Status](https://travis-ci.org/evheniy/yeps.svg?branch=master)](https://travis-ci.org/evheniy/yeps) [![Coverage Status](https://coveralls.io/repos/github/evheniy/yeps/badge.svg?branch=master)](https://coveralls.io/github/evheniy/yeps?branch=master) [![Linux Build](https://img.shields.io/travis/evheniy/yeps/master.svg?label=linux)](https://travis-ci.org/evheniy/) diff --git a/appveyor.yml b/appveyor.yml index 5834723..f24e51c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,5 +10,6 @@ test_script: - node --version - npm --version - npm run lint - - npm run test + - npm run test:security + - npm run test:code build: off \ No newline at end of file diff --git a/package.json b/package.json index b636ca3..435ec95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yeps", - "version": "0.0.6", + "version": "0.0.7", "description": "Yet Another Event Promised Server", "main": "index.js", "scripts": { @@ -8,6 +8,7 @@ "lint:js": "./node_modules/.bin/eslint index.js tests", "test": "./node_modules/.bin/npm-run-all test:**", "test:security": "./node_modules/.bin/nsp check", + "test:code": "node --harmony ./node_modules/mocha/bin/_mocha tests --recursive", "test:coverage": "node --harmony ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- tests --recursive", "report": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls", "clear": "./node_modules/.bin/rimraf coverage", diff --git a/tests/index.js b/tests/index.js index 59b5766..0ffd1dd 100644 --- a/tests/index.js +++ b/tests/index.js @@ -95,6 +95,32 @@ describe('YAPS test', () => { return expect(isTestFinished).is.true; }); + it('should test error handler without Promise.reject()', async () => { + + const text = 'error'; + let isTestFinished = false; + + app.then(async () => { + throw new Error(text); + }); + + app.catch(async (err, ctx) => { + ctx.res.writeHead(200); + ctx.res.end(err.message); + }); + + await chai.request(http.createServer(app.resolve())) + .get('/') + .send() + .then(res => { + expect(res).to.have.status(200); + expect(res.text).to.be.equal(text); + isTestFinished = true; + }); + + return expect(isTestFinished).is.true; + }); + it('should test breaking of promises chain', async () => { let isTestFinished = false;