File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ var ajv = new Ajv({allErrors: true});
3
3
var json = require ( './schema.json' ) ;
4
4
5
5
module . exports = function validate ( data ) {
6
- var validSchema = ajv . compile ( json ) ;
7
- var valid = validSchema ( data ) ;
6
+ var ajv = new Ajv ( ) ;
7
+ var isValid = ajv . validate ( json , data ) ;
8
8
9
- if ( ! valid ) {
9
+ if ( ! isValid ) {
10
10
throw new Error ( ajv . errorsText ( ) ) ;
11
11
}
12
12
}
Original file line number Diff line number Diff line change @@ -24,9 +24,14 @@ describe("ExtractTextPlugin.extract()", function() {
24
24
} ) ;
25
25
26
26
it ( "throws if an incorrect config is passed in" , function ( ) {
27
- should . throws ( function ( ) {
28
- ExtractTextPlugin . extract ( { style : 'file.css' } ) ;
29
- } ) ;
27
+ should . throws (
28
+ function ( ) {
29
+ ExtractTextPlugin . extract ( { style : 'file.css' } ) ;
30
+ } ,
31
+ function ( err ) {
32
+ return err . message === 'data should NOT have additional properties' ;
33
+ }
34
+ ) ;
30
35
} ) ;
31
36
} ) ;
32
37
You can’t perform that action at this time.
0 commit comments