Skip to content

Commit 7bf109a

Browse files
authored
Merge pull request #8 from micheleangioni/source-getter
Added missing 'source' getter on Spec02
2 parents 2cc5999 + 1dca221 commit 7bf109a

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,3 @@ jobs:
2525
skip_cleanup: true
2626
on:
2727
tags: true
28-
env:
29-
global:
30-
secure: t0A5/Fk1Qj8WkAk0ZuQqpFjrpINV6gfL+d1fXgq03EOAG/7FEyyz+AKkYaLT6avp26VWBzLgEoWC3RNmWD0v1/Ruckb95YpQcb5e4JotAce1ZsHgGTgx0UO146tkyGvXBw6MmO2nX2O/sHzkmyR6rlKkBi9LEKokJ9OFd6fi9nNtksgUDxkqNlNTu100fIQAV2RcN47C6iUx+gJIa+H/8QX/Cz02MyheXLe8a763wMQapz5GHrk2KuVY6FpylcAlSi2so+PjEGfKq3MWaQnTPkevkRDLtGcecVtFAq/0VbvoKc97PHoVT0x+nf48k1gj2VnQtYj6EVB74yRvqM9KkNOsfAQ0z9zF5wXMRs11SZywSViLQsnD9Ue6eYbYmodOKn4DFlLtoRyLBUspzLuoL76lERGe2cHU+Ebz2Nb9jL88o+SjfGrSJQEJU7SLZLbzJ7T/3SspWcAlo+Fo9UTCOB4/yL22Yge/SWQkdd1orBhohpjpyrU9Z1+IRvVoU1EICr04zSFUwEwn6Yxbt0ArgTZBEf11bf+YpCo+rBXNAd+XbZ79PGOEppFb+Hxrt9i1S1RnesDJnwC0k7cswU55Rv5gcNCo9lC+N4ZwS5y+5r6DsBfB+12YdsFORFyNbClECro1ODv4STf3rBBnjL8+ziPFjP4d4OwiGY+vG8bvLXY=
31-
script: npm run coverage

lib/specs/spec_0_2.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ Spec02.prototype.source = function(_source){
5959
return this;
6060
};
6161

62+
Spec02.prototype.getSource = function() {
63+
return this.payload["source"];
64+
};
65+
6266
Spec02.prototype.id = function(_id){
6367
this.payload["id"] = _id;
6468
return this;

test/cloudevent_spec_0_1.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ var cloudevent = new Cloudevent()
1515

1616
describe("CloudEvents Spec 0.1 - JavaScript SDK", () => {
1717

18+
describe("Object properties", () => {
19+
20+
describe("Attribute getters", () => {
21+
it("returns 'type'", () => {
22+
expect(cloudevent.getType()).to.equal(type);
23+
});
24+
25+
it("returns 'source'", () => {
26+
expect(cloudevent.getSource()).to.equal(source);
27+
});
28+
});
29+
});
30+
1831
describe("JSON Format", () => {
1932

2033
describe("Required context attributes", () => {

test/cloudevent_spec_0_2.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,26 @@ const contenttype = "application/json";
99
const data = {};
1010
const extensions = {};
1111

12-
var cloudevent =
12+
var cloudevent =
1313
new Cloudevent(Cloudevent.specs["0.2"])
1414
.type(type)
1515
.source(source);
1616

1717
describe("CloudEvents Spec 0.2 - JavaScript SDK", () => {
1818

19+
describe("Object properties", () => {
20+
21+
describe("Attribute getters", () => {
22+
it("returns 'type'", () => {
23+
expect(cloudevent.getType()).to.equal(type);
24+
});
25+
26+
it("returns 'source'", () => {
27+
expect(cloudevent.getSource()).to.equal(source);
28+
});
29+
});
30+
});
31+
1932
describe("JSON Format", () => {
2033

2134
describe("Required context attributes", () => {
@@ -68,8 +81,8 @@ describe("CloudEvents Spec 0.2 - JavaScript SDK", () => {
6881
});
6982

7083
it("should throw an error when employ reserved name as extension", () => {
71-
72-
var cevt =
84+
85+
var cevt =
7386
new Cloudevent(Cloudevent.specs["0.2"])
7487
.type(type)
7588
.source(source);

0 commit comments

Comments
 (0)