Skip to content

Commit 433ecc3

Browse files
committed
squash: inline some tests
1 parent c20a10f commit 433ecc3

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

test/spec_1_tests.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,40 +65,34 @@ describe("CloudEvents Spec v1.0", () => {
6565

6666
describe("Extensions Constraints", () => {
6767
it("should be ok when type is 'boolean'", () => {
68-
cloudevent = cloudevent.cloneWith({ "ext-boolean": true });
69-
expect(cloudevent.validate()).to.equal(true);
68+
expect(cloudevent.cloneWith({ "ext-boolean": true }).validate()).to.equal(true);
7069
});
7170

7271
it("should be ok when type is 'integer'", () => {
73-
cloudevent = cloudevent.cloneWith({ "ext-integer": 2019 });
74-
expect(cloudevent.validate()).to.equal(true);
72+
expect(cloudevent.cloneWith({ "ext-integer": 2019 }).validate()).to.equal(true);
7573
});
7674

7775
it("should be ok when type is 'string'", () => {
78-
cloudevent = cloudevent.cloneWith({ "ext-string": "an-string" });
79-
expect(cloudevent.validate()).to.equal(true);
76+
expect(cloudevent.cloneWith({ "ext-string": "an-string" }).validate()).to.equal(true);
8077
});
8178

8279
it("should be ok when type is 'Uint32Array' for 'Binary'", () => {
8380
const myBinary = new Uint32Array(2019);
84-
cloudevent = cloudevent.cloneWith({ "ext-binary": myBinary });
85-
expect(cloudevent.validate()).to.equal(true);
81+
expect(cloudevent.cloneWith({ "ext-binary": myBinary }).validate()).to.equal(true);
8682
});
8783

8884
// URI
8985
it("should be ok when type is 'Date' for 'Timestamp'", () => {
9086
const myDate = new Date();
91-
cloudevent = cloudevent.cloneWith({ "ext-date": myDate });
92-
expect(cloudevent.validate()).to.equal(true);
87+
expect(cloudevent.cloneWith({ "ext-date": myDate }).validate()).to.equal(true);
9388
});
9489

9590
// even though the spec doesn't allow object types for
9691
// extensions, it could be JSON. And before a JS CE
9792
// is transmitted across the wire, this value will be
9893
// converted to JSON
9994
it("should be ok when the type is an object", () => {
100-
cloudevent = cloudevent.cloneWith({ "object-extension": { some: "object" } });
101-
expect(cloudevent.validate()).to.equal(true);
95+
expect(cloudevent.cloneWith({ "object-extension": { some: "object" } }).validate()).to.equal(true);
10296
});
10397
});
10498

0 commit comments

Comments
 (0)