Skip to content

Commit

Permalink
new test
Browse files Browse the repository at this point in the history
  • Loading branch information
Evheniy Bystrov committed Feb 13, 2017
1 parent 3604985 commit 0dc95e9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "yeps",
"version": "0.0.6",
"version": "0.0.7",
"description": "Yet Another Event Promised Server",
"main": "index.js",
"scripts": {
"lint": "./node_modules/.bin/npm-run-all lint:**",
"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",
Expand Down
26 changes: 26 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0dc95e9

Please sign in to comment.