File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -66,10 +66,10 @@ describe("JSON Event Format Parser", () => {
66
66
. to . throw ( "invalid json payload" ) ;
67
67
} ) ;
68
68
69
- it ( "Throw error when payload is an invalid CloudEvent spec 0.2" , ( ) => {
69
+ it ( "Must accept the CloudEvent spec 0.2 as JSON " , ( ) => {
70
70
// setup
71
71
var payload =
72
- new Cloudevent ( )
72
+ new Cloudevent ( Cloudevent . specs [ "0.2" ] )
73
73
. type ( type )
74
74
. source ( source )
75
75
. contenttype ( ceContentType )
@@ -80,24 +80,18 @@ describe("JSON Event Format Parser", () => {
80
80
81
81
var parser = new Parser ( ) ;
82
82
83
- // act and assert
84
- expect ( parser . parse . bind ( parser , payload ) )
85
- . to . throw ( "invalid payload" ) ;
83
+ // act
84
+ var actual = parser . parse ( payload ) ;
85
+
86
+ // assert
87
+ expect ( actual )
88
+ . to . be . an ( "object" ) ;
86
89
} ) ;
87
90
88
- it ( "Must accept the CloudEvent spec 0.2 as JSON" , ( ) => {
91
+ it ( "Must accept when the payload is a string well formed as JSON" , ( ) => {
89
92
// setup
90
- var payload =
91
- new Cloudevent ( Cloudevent . specs [ "0.2" ] )
92
- . type ( type )
93
- . source ( source )
94
- . contenttype ( ceContentType )
95
- . time ( now )
96
- . schemaurl ( schemaurl )
97
- . data ( data )
98
- . toString ( ) ;
99
-
100
- var parser = new Parser ( new Cloudevent . specs [ "0.2" ] ( ) ) ;
93
+ var payload = "{\"much\" : \"wow\"}" ;
94
+ var parser = new Parser ( ) ;
101
95
102
96
// act
103
97
var actual = parser . parse ( payload ) ;
You can’t perform that action at this time.
0 commit comments