Skip to content

Commit

Permalink
chore(tests):Cover gaps in exceptions and model
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhenry committed Jun 21, 2016
1 parent 259f05c commit 9ee9a17
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/common/models/model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,15 @@ describe('Model', () => {
});

});

describe('UUID', () => {

it('extends String', () => {

const id = new UUID('72eed629-c4ab-4520-a987-4ea26b134d8c');

expect(id instanceof UUID).toBe(true);
expect(id instanceof String).toBe(true);
});

});
19 changes: 19 additions & 0 deletions src/server/exeptions/exceptions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
HttpException,
ValidationException
} from './exceptions';
import { ValidationErrorInterface } from 'class-validator/ValidationErrorInterface';

describe('Exceptions', () => {

Expand Down Expand Up @@ -83,4 +84,22 @@ describe('Exceptions', () => {
expect(exception instanceof UnprocessableEntityException).toBe(true);
});

it('retrieves data from exception with .data()', () => {

let errors:ValidationErrorInterface[] = [{
objectClass: null,
property: 'name',
errorCode: 302,
errorName: 'max_length',
errorMessage: 'too long',
value: 10,
required: true,
}];

let exception = new ValidationException(null, errors);

expect(exception.getData()).toEqual(errors);

});

});

0 comments on commit 9ee9a17

Please sign in to comment.