From 0caebd4bfdfd9c8d7840fc379412d5d1f867575f Mon Sep 17 00:00:00 2001 From: jw255 Date: Sat, 3 Mar 2018 14:53:31 +0000 Subject: pulled latest files from trh/payload-checker --- src/errors/errorware.test.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/errors/errorware.test.ts (limited to 'src/errors/errorware.test.ts') diff --git a/src/errors/errorware.test.ts b/src/errors/errorware.test.ts new file mode 100644 index 0000000..eb85cc6 --- /dev/null +++ b/src/errors/errorware.test.ts @@ -0,0 +1,35 @@ +/* tslint:disable:no-unused-expression */ +// Disabled to allow chai-style assertions. + +import * as chai from 'chai'; +chai.should(); + +import { ErrorResponseBlock, RequestError } from './errorware'; + +describe('RequestError', () => { + describe('constructor', () => { + it('constructs simple errors', () => { + const err: RequestError = new RequestError( + 404, 'user_not_found' + ); + err.code.should.equal(404); + err.name.should.equal('user_not_found'); + }); + it('constructs with sensible defaults', () => { + const err: RequestError = new RequestError(); + err.code.should.not.be.undefined; + err.name.should.not.be.undefined; + }); + }); + describe('response generation', () => { + it('generates responses', () => { + const err: RequestError = new RequestError( + 500, 'internal_server_error' + ); + const response: ErrorResponseBlock = + err.responseBlock(); + response.status.should.equal('error'); + response.error.should.equal('internal_server_error'); + }); + }); +}); -- cgit v1.2.1 From dfa461025cece1c17d70f0763848ab434a62ed8d Mon Sep 17 00:00:00 2001 From: jw255 Date: Mon, 5 Mar 2018 17:57:19 +0000 Subject: authentication tests in progress --- src/errors/errorware.test.ts | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/errors/errorware.test.ts (limited to 'src/errors/errorware.test.ts') diff --git a/src/errors/errorware.test.ts b/src/errors/errorware.test.ts deleted file mode 100644 index eb85cc6..0000000 --- a/src/errors/errorware.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* tslint:disable:no-unused-expression */ -// Disabled to allow chai-style assertions. - -import * as chai from 'chai'; -chai.should(); - -import { ErrorResponseBlock, RequestError } from './errorware'; - -describe('RequestError', () => { - describe('constructor', () => { - it('constructs simple errors', () => { - const err: RequestError = new RequestError( - 404, 'user_not_found' - ); - err.code.should.equal(404); - err.name.should.equal('user_not_found'); - }); - it('constructs with sensible defaults', () => { - const err: RequestError = new RequestError(); - err.code.should.not.be.undefined; - err.name.should.not.be.undefined; - }); - }); - describe('response generation', () => { - it('generates responses', () => { - const err: RequestError = new RequestError( - 500, 'internal_server_error' - ); - const response: ErrorResponseBlock = - err.responseBlock(); - response.status.should.equal('error'); - response.error.should.equal('internal_server_error'); - }); - }); -}); -- cgit v1.2.1