You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('should error if the "bucket" property is missing',()=>{
748
+
shouldError(
749
+
'child "s3" fails because [child "bucket" fails because ["bucket" is required]]',
750
+
null,
751
+
null,
752
+
'bucket'
753
+
)
754
+
})
755
+
756
+
it('should succeed if the "bucket" property is string or AWS Ref function',()=>{
757
+
shouldSucceed('bucket','x')
758
+
shouldSucceed('bucket',{Ref: 'x'})
759
+
})
760
+
761
+
it('should error if the "bucket" property if AWS Ref function is invalid',()=>{
762
+
shouldError(
763
+
'child "s3" fails because [child "bucket" fails because ["bucket" must be a string, child "Ref" fails because ["Ref" is required]]]',
764
+
'bucket',
765
+
{xxx: 's3Bucket'}
766
+
)
767
+
shouldError(
768
+
'child "s3" fails because [child "bucket" fails because ["bucket" must be a string, child "Ref" fails because ["Ref" must be a string]]]',
769
+
'bucket',
770
+
{Ref: ['s3Bucket','Arn']}
771
+
)
772
+
shouldError(
773
+
'child "s3" fails because [child "bucket" fails because ["bucket" must be a string, "bucket" must be an object]]',
774
+
'bucket',
775
+
['xx','yy']
776
+
)
777
+
shouldError(
778
+
'child "s3" fails because [child "bucket" fails because ["bucket" must be a string, child "Ref" fails because ["Ref" is required]]]',
779
+
'bucket',
780
+
{'Fn::GetAtt': ['x','Arn']}
781
+
)
782
+
})
783
+
784
+
it('should error if the "action" property is missing',()=>{
785
+
shouldError(
786
+
'child "s3" fails because [child "action" fails because ["action" is required]]',
787
+
null,
788
+
null,
789
+
'action'
790
+
)
791
+
})
792
+
793
+
it('should error if the "action" property is not one of the allowed values',()=>{
794
+
shouldError(
795
+
'child "s3" fails because [child "action" fails because ["action" must be a string]]',
796
+
'action',
797
+
['x']
798
+
)// arrays
799
+
shouldError(
800
+
'child "s3" fails because [child "action" fails because ["action" must be a string]]',
801
+
'action',
802
+
{Ref: 'x'}
803
+
)// object
804
+
shouldError(
805
+
'child "s3" fails because [child "action" fails because ["action" must be one of [GetObject, PutObject, DeleteObject]]]',
806
+
'action',
807
+
'ListObjects'
808
+
)// invalid actions
809
+
})
810
+
811
+
it('should succeed if the "action" property is one of the allowed values',()=>{
812
+
shouldSucceed('action','GetObject')
813
+
shouldSucceed('action','PutObject')
814
+
shouldSucceed('action','DeleteObject')
815
+
})
816
+
817
+
it('should error the "key" property is missing',()=>{
818
+
shouldError(
819
+
'child "s3" fails because [child "key" fails because ["key" is required]]',
820
+
null,
821
+
null,
822
+
'key'
823
+
)
824
+
})
825
+
826
+
it('should succeed if the "key" property is string or valid object',()=>{
827
+
shouldSucceed('key','myKey')
828
+
shouldSucceed('key',{pathParam: 'myKey'})
829
+
shouldSucceed('key',{queryStringParam: 'myKey'})
830
+
})
831
+
832
+
it('should error if the "key" property specifies both pathParam and queryStringParam',()=>{
833
+
shouldError(
834
+
'child "s3" fails because [child "key" fails because ["key" must be a string, key must contain "pathParam" or "queryStringParam" but not both]]',
835
+
'key',
836
+
{pathParam: 'myKey',queryStringParam: 'myKey'}
837
+
)
838
+
})
839
+
840
+
it('should error if the "key" property is not a string or valid object',()=>{
841
+
shouldError(
842
+
'child "s3" fails because [child "key" fails because ["key" must be a string, "key" must be an object]]',
843
+
'key',
844
+
['x']
845
+
)
846
+
shouldError(
847
+
'child "s3" fails because [child "key" fails because ["key" must be a string, "param" is not allowed, "key" must contain at least one of [pathParam, queryStringParam]]]',
848
+
'key',
849
+
{param: 'myKey'}
850
+
)
851
+
})
852
+
})
853
+
700
854
describe('sqs',()=>{
701
855
it('should throw if requestParameters is not a string to string',()=>{
0 commit comments