@@ -733,60 +733,60 @@ describe('Service', () => {
733
733
}
734
734
735
735
it ( `should not throw an error if http event is absent and
736
- stage contains only alphanumeric, underscore and hyphen` , function ( ) {
737
- this . timeout ( 10000 ) ; // Occasionally times out with default settings
738
- const SUtils = new Utils ( ) ;
739
- const serverlessYml = {
740
- service : 'new-service' ,
741
- provider : {
742
- name : 'aws' ,
743
- stage : 'xyz-101_abc-123' ,
744
- } ,
745
- functions : {
746
- first : {
747
- events : [ ] ,
748
- } ,
736
+ stage contains only alphanumeric, underscore and hyphen` , function ( ) {
737
+ this . timeout ( 10000 ) ; // Occasionally times out with default settings
738
+ const SUtils = new Utils ( ) ;
739
+ const serverlessYml = {
740
+ service : 'new-service' ,
741
+ provider : {
742
+ name : 'aws' ,
743
+ stage : 'xyz-101_abc-123' ,
744
+ } ,
745
+ functions : {
746
+ first : {
747
+ events : [ ] ,
749
748
} ,
750
- } ;
751
- SUtils . writeFileSync ( path . join ( tmpDirPath , 'serverless.yml' ) ,
752
- YAML . dump ( serverlessYml ) ) ;
749
+ } ,
750
+ } ;
751
+ SUtils . writeFileSync ( path . join ( tmpDirPath , 'serverless.yml' ) ,
752
+ YAML . dump ( serverlessYml ) ) ;
753
753
754
- const serverless = new Serverless ( { servicePath : tmpDirPath } ) ;
755
- return expect ( simulateRun ( serverless ) ) . to . eventually . be . fulfilled . then ( ( ) => {
756
- expect ( ( ) => serverless . service . validate ( ) ) . to . not . throw ( serverless . classes . Error ) ;
757
- } ) ;
754
+ const serverless = new Serverless ( { servicePath : tmpDirPath } ) ;
755
+ return expect ( simulateRun ( serverless ) ) . to . eventually . be . fulfilled . then ( ( ) => {
756
+ expect ( ( ) => serverless . service . validate ( ) ) . to . not . throw ( serverless . classes . Error ) ;
758
757
} ) ;
758
+ } ) ;
759
759
760
760
it ( `should not throw an error after variable population if http event is present and
761
- the populated stage contains only alphanumeric, underscore and hyphen` , ( ) => {
762
- const SUtils = new Utils ( ) ;
763
- const serverlessYml = {
764
- service : 'new-service' ,
765
- provider : {
766
- name : 'aws' ,
767
- stage : '${opt:stage, "default-stage"}' ,
768
- } ,
769
- functions : {
770
- first : {
771
- events : [
772
- {
773
- http : {
774
- path : 'foo' ,
775
- method : 'GET' ,
776
- } ,
761
+ the populated stage contains only alphanumeric, underscore and hyphen` , ( ) => {
762
+ const SUtils = new Utils ( ) ;
763
+ const serverlessYml = {
764
+ service : 'new-service' ,
765
+ provider : {
766
+ name : 'aws' ,
767
+ stage : '${opt:stage, "default-stage"}' ,
768
+ } ,
769
+ functions : {
770
+ first : {
771
+ events : [
772
+ {
773
+ http : {
774
+ path : 'foo' ,
775
+ method : 'GET' ,
777
776
} ,
778
- ] ,
779
- } ,
777
+ } ,
778
+ ] ,
780
779
} ,
781
- } ;
782
- SUtils . writeFileSync ( path . join ( tmpDirPath , 'serverless.yml' ) ,
783
- YAML . dump ( serverlessYml ) ) ;
780
+ } ,
781
+ } ;
782
+ SUtils . writeFileSync ( path . join ( tmpDirPath , 'serverless.yml' ) ,
783
+ YAML . dump ( serverlessYml ) ) ;
784
784
785
- const serverless = new Serverless ( { servicePath : tmpDirPath } ) ;
786
- return expect ( simulateRun ( serverless ) ) . to . eventually . be . fulfilled . then ( ( ) => {
787
- expect ( ( ) => serverless . service . validate ( ) ) . to . not . throw ( serverless . classes . Error ) ;
788
- } ) ;
785
+ const serverless = new Serverless ( { servicePath : tmpDirPath } ) ;
786
+ return expect ( simulateRun ( serverless ) ) . to . eventually . be . fulfilled . then ( ( ) => {
787
+ expect ( ( ) => serverless . service . validate ( ) ) . to . not . throw ( serverless . classes . Error ) ;
789
788
} ) ;
789
+ } ) ;
790
790
791
791
it ( 'should throw an error if http event is present and stage contains invalid chars' , ( ) => {
792
792
const SUtils = new Utils ( ) ;
@@ -824,38 +824,38 @@ describe('Service', () => {
824
824
825
825
it ( `should throw an error after variable population
826
826
if http event is present and stage contains hyphen` , ( ) => {
827
- const SUtils = new Utils ( ) ;
828
- const serverlessYml = {
829
- service : 'new-service' ,
830
- provider : {
831
- name : 'aws' ,
832
- stage : '${opt:stage, "default:stage"}' ,
833
- } ,
834
- functions : {
835
- first : {
836
- events : [
837
- {
838
- http : {
839
- path : 'foo' ,
840
- method : 'GET' ,
841
- } ,
827
+ const SUtils = new Utils ( ) ;
828
+ const serverlessYml = {
829
+ service : 'new-service' ,
830
+ provider : {
831
+ name : 'aws' ,
832
+ stage : '${opt:stage, "default:stage"}' ,
833
+ } ,
834
+ functions : {
835
+ first : {
836
+ events : [
837
+ {
838
+ http : {
839
+ path : 'foo' ,
840
+ method : 'GET' ,
842
841
} ,
843
- ] ,
844
- } ,
842
+ } ,
843
+ ] ,
845
844
} ,
846
- } ;
847
- SUtils . writeFileSync ( path . join ( tmpDirPath , 'serverless.yml' ) ,
848
- YAML . dump ( serverlessYml ) ) ;
849
-
850
- const serverless = new Serverless ( { servicePath : tmpDirPath } ) ;
851
- return expect ( simulateRun ( serverless ) ) . to . eventually . be . fulfilled . then ( ( ) => {
852
- expect ( ( ) => serverless . service . validate ( ) ) . to . throw ( serverless . classes . Error , [
853
- 'Invalid stage name default:stage: it should contains only [-_a-zA-Z0-9]' ,
854
- 'for AWS provider if http event are present ',
855
- 'according to API Gateway limitation. ',
856
- ] . join ( ' ' ) ) ;
857
- } ) ;
845
+ } ,
846
+ } ;
847
+ SUtils . writeFileSync ( path . join ( tmpDirPath , 'serverless.yml' ) ,
848
+ YAML . dump ( serverlessYml ) ) ;
849
+
850
+ const serverless = new Serverless ( { servicePath : tmpDirPath } ) ;
851
+ return expect ( simulateRun ( serverless ) ) . to . eventually . be . fulfilled . then ( ( ) => {
852
+ expect ( ( ) => serverless . service . validate ( ) ) . to . throw ( serverless . classes . Error , [
853
+ 'Invalid stage name default:stage: it should contains only [-_a-zA-Z0-9] ',
854
+ 'for AWS provider if http event are present ',
855
+ 'according to API Gateway limitation.' ,
856
+ ] . join ( ' ' ) ) ;
858
857
} ) ;
858
+ } ) ;
859
859
} ) ;
860
860
} ) ;
861
861
0 commit comments