Skip to content

Commit 3ff6405

Browse files
snitin315alexander-akait
authored andcommitted
test: add validation tests
1 parent 551d273 commit 3ff6405

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

test/__snapshots__/validate-options.test.js.snap.webpack4

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,27 @@ exports[`options validate should throw an error on the "server" option with '{"t
714714
-> Request for an SSL certificate."
715715
`;
716716

717+
exports[`options validate should throw an error on the "setupMiddlewares" option with '10' value 1`] = `
718+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
719+
- options.setupMiddlewares should be an instance of function.
720+
-> Provides the ability to execute a custom function and apply custom middleware(s).
721+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"
722+
`;
723+
724+
exports[`options validate should throw an error on the "setupMiddlewares" option with 'false' value 1`] = `
725+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
726+
- options.setupMiddlewares should be an instance of function.
727+
-> Provides the ability to execute a custom function and apply custom middleware(s).
728+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"
729+
`;
730+
731+
exports[`options validate should throw an error on the "setupMiddlewares" option with 'true' value 1`] = `
732+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
733+
- options.setupMiddlewares should be an instance of function.
734+
-> Provides the ability to execute a custom function and apply custom middleware(s).
735+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"
736+
`;
737+
717738
exports[`options validate should throw an error on the "static" option with '' value 1`] = `
718739
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
719740
- options.static should be a non-empty string."

test/__snapshots__/validate-options.test.js.snap.webpack5

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,27 @@ exports[`options validate should throw an error on the "server" option with '{"t
714714
-> Request for an SSL certificate."
715715
`;
716716

717+
exports[`options validate should throw an error on the "setupMiddlewares" option with '10' value 1`] = `
718+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
719+
- options.setupMiddlewares should be an instance of function.
720+
-> Provides the ability to execute a custom function and apply custom middleware(s).
721+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"
722+
`;
723+
724+
exports[`options validate should throw an error on the "setupMiddlewares" option with 'false' value 1`] = `
725+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
726+
- options.setupMiddlewares should be an instance of function.
727+
-> Provides the ability to execute a custom function and apply custom middleware(s).
728+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"
729+
`;
730+
731+
exports[`options validate should throw an error on the "setupMiddlewares" option with 'true' value 1`] = `
732+
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
733+
- options.setupMiddlewares should be an instance of function.
734+
-> Provides the ability to execute a custom function and apply custom middleware(s).
735+
-> Read more at https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"
736+
`;
737+
717738
exports[`options validate should throw an error on the "static" option with '' value 1`] = `
718739
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
719740
- options.static should be a non-empty string."

test/validate-options.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,10 @@ const tests = {
514514
},
515515
],
516516
},
517+
setupMiddlewares: {
518+
success: [() => {}],
519+
failure: [false, 10, "true"],
520+
},
517521
webSocketServer: {
518522
success: [
519523
false,

0 commit comments

Comments
 (0)