@@ -42,6 +42,26 @@ describe("Task builders", () => {
42
42
} ) ;
43
43
} ) ;
44
44
45
+ describe ( "Task id validation" , ( ) => {
46
+ it ( "should throw if the id is an empty string" , ( ) => {
47
+ assert . throws ( ( ) => new NewTaskDefinitionBuilderImplementation ( "" ) , {
48
+ name : "HardhatError" ,
49
+ message :
50
+ "HHE208: Task id cannot be an empty string or an empty array" ,
51
+ } ) ;
52
+ } ) ;
53
+
54
+ it ( "should throw if the array of ids is empty" , ( ) => {
55
+ const ids : string [ ] = [ ] ;
56
+
57
+ assert . throws ( ( ) => new NewTaskDefinitionBuilderImplementation ( ids ) , {
58
+ name : "HardhatError" ,
59
+ message :
60
+ "HHE208: Task id cannot be an empty string or an empty array" ,
61
+ } ) ;
62
+ } ) ;
63
+ } ) ;
64
+
45
65
describe ( "Adding an action" , ( ) => {
46
66
it ( "should create a new task definition builder with an async function action" , ( ) => {
47
67
const builder = new NewTaskDefinitionBuilderImplementation ( "task-id" ) ;
@@ -724,6 +744,32 @@ describe("Task builders", () => {
724
744
} ) ;
725
745
} ) ;
726
746
747
+ describe ( "Task id validation" , ( ) => {
748
+ it ( "should throw if the id is an empty string" , ( ) => {
749
+ assert . throws (
750
+ ( ) => new TaskOverrideDefinitionBuilderImplementation ( "" ) ,
751
+ {
752
+ name : "HardhatError" ,
753
+ message :
754
+ "HHE208: Task id cannot be an empty string or an empty array" ,
755
+ } ,
756
+ ) ;
757
+ } ) ;
758
+
759
+ it ( "should throw if the array of ids is empty" , ( ) => {
760
+ const ids : string [ ] = [ ] ;
761
+
762
+ assert . throws (
763
+ ( ) => new TaskOverrideDefinitionBuilderImplementation ( ids ) ,
764
+ {
765
+ name : "HardhatError" ,
766
+ message :
767
+ "HHE208: Task id cannot be an empty string or an empty array" ,
768
+ } ,
769
+ ) ;
770
+ } ) ;
771
+ } ) ;
772
+
727
773
describe ( "Adding an action" , ( ) => {
728
774
it ( "should create a task override definition builder with an async function action" , ( ) => {
729
775
const builder = new TaskOverrideDefinitionBuilderImplementation (
0 commit comments