Skip to content

Commit 3daed0b

Browse files
committed
squash: tests that delete fields should throw a TypeError
Signed-off-by: Lucas Holmquist <[email protected]>
1 parent 783095e commit 3daed0b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

test/integration/spec_03_tests.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe("CloudEvents Spec v0.3", () => {
8686
it("should throw an error when trying to remove", () => {
8787
expect(() => {
8888
delete cloudevent.id;
89-
}).to.throw();
89+
}).to.throw(TypeError);
9090
});
9191

9292
it("defaut ID create when an empty string", () => {
@@ -99,29 +99,29 @@ describe("CloudEvents Spec v0.3", () => {
9999
it("should throw an error when trying to remove", () => {
100100
expect(() => {
101101
delete cloudevent.source;
102-
}).to.throw();
102+
}).to.throw(TypeError);
103103
});
104104
});
105105

106106
describe("'specversion'", () => {
107107
it("should throw an error when trying to remove", () => {
108108
expect(() => {
109109
delete cloudevent.specversion;
110-
}).to.throw();
110+
}).to.throw(TypeError);
111111
});
112112
});
113113

114114
describe("'type'", () => {
115115
it("should throw an error when trying to remove", () => {
116116
expect(() => {
117117
delete cloudevent.type;
118-
}).to.throw();
118+
}).to.throw(TypeError);
119119
});
120120

121121
it("should throw an error when is an empty string", () => {
122122
expect(() => {
123123
cloudevent.cloneWith({ type: "" });
124-
}).to.throw(ValidationError);
124+
}).to.throw(ValidationError, "invalid payload");
125125
});
126126

127127
it("must be a non-empty string", () => {

test/integration/spec_1_tests.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe("CloudEvents Spec v1.0", () => {
101101
it("should throw an error when trying to remove", () => {
102102
expect(() => {
103103
delete cloudevent.id;
104-
}).to.throw();
104+
}).to.throw(TypeError);
105105
});
106106

107107
it("defaut ID create when an empty string", () => {
@@ -114,31 +114,31 @@ describe("CloudEvents Spec v1.0", () => {
114114
it("should throw an error when trying to remove", () => {
115115
expect(() => {
116116
delete cloudevent.source;
117-
}).to.throw();
117+
}).to.throw(TypeError);
118118
});
119119
});
120120

121121
describe("'specversion'", () => {
122122
it("should throw an error when trying to remove", () => {
123123
expect(() => {
124124
delete cloudevent.specversion;
125-
}).to.throw();
125+
}).to.throw(TypeError);
126126
});
127127
});
128128

129129
describe("'type'", () => {
130130
it("should throw an error when trying to remove", () => {
131131
expect(() => {
132132
delete cloudevent.type;
133-
}).to.throw();
133+
}).to.throw(TypeError);
134134
});
135135
});
136136

137137
describe("'subject'", () => {
138138
it("should throw an error when is an empty string", () => {
139139
expect(() => {
140140
cloudevent.cloneWith({ subject: "" });
141-
}).to.throw(ValidationError);
141+
}).to.throw(ValidationError, "invalid payload");
142142
});
143143
});
144144

0 commit comments

Comments
 (0)