File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ export interface IPresentValidatorDefinition extends IBaseValidatorDefinition {}
13
13
export class PresentValidator implements IValidator < any , IPresentValidatorDefinition > {
14
14
private static rWhiteSpace : RegExp = / ^ [ \t \n \v \f \r ] * $ / ;
15
15
16
- constructor ( public definition : IPresentValidatorDefinition ) { }
16
+ constructor ( public definition : IPresentValidatorDefinition ) {
17
+ this . definition . type = "present" ;
18
+ }
17
19
18
20
public validate ( input : any ) : IValidationError < any , IPresentValidatorDefinition > {
19
21
const invalid = {
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ describe("PresentValidator", () => {
6
6
describe ( "validate" , ( ) => {
7
7
8
8
it ( `should be invalid if the input is undefined or null` , ( ) => {
9
- const definition = { } ;
9
+ const definition = {
10
+ type : "present" ,
11
+ } ;
10
12
const validator = new PresentValidator ( { } ) ;
11
13
[
12
14
{
@@ -30,7 +32,9 @@ describe("PresentValidator", () => {
30
32
} ) ;
31
33
32
34
it ( `should be invalid if the input consisting only white space` , ( ) => {
33
- const definition = { } ;
35
+ const definition = {
36
+ type : "present" ,
37
+ } ;
34
38
const validator = new PresentValidator ( { } ) ;
35
39
[
36
40
{
@@ -111,7 +115,9 @@ describe("PresentValidator", () => {
111
115
} ) ;
112
116
113
117
it ( `should be invalid if the input is empty array` , ( ) => {
114
- const definition = { } ;
118
+ const definition = {
119
+ type : "present" ,
120
+ } ;
115
121
const validator = new PresentValidator ( { } ) ;
116
122
[
117
123
{
@@ -132,7 +138,9 @@ describe("PresentValidator", () => {
132
138
} ) ;
133
139
134
140
it ( `should be invalid if the input is empty object` , ( ) => {
135
- const definition = { } ;
141
+ const definition = {
142
+ type : "present" ,
143
+ } ;
136
144
const validator = new PresentValidator ( { } ) ;
137
145
[
138
146
{
You can’t perform that action at this time.
0 commit comments