Skip to content

Commit d418a50

Browse files
loopingzlance
authored andcommitted
ci: add unit test for emitter
Signed-off-by: Remi Cattiau <[email protected]>
1 parent bda8581 commit d418a50

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/integration/emitter_factory_test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const data = {
2323
lunchBreak: "noon",
2424
};
2525

26-
const fixture = new CloudEvent({
26+
export const fixture = new CloudEvent({
2727
source,
2828
type,
2929
data,
@@ -107,7 +107,13 @@ function testEmitter(fn: TransportFunction, bodyAttr: string) {
107107
});
108108
}
109109

110-
function assertBinary(response: Record<string, string>) {
110+
/**
111+
* Verify the received binary answer compare to the original fixture message
112+
*
113+
* @param {Record<string, Record<string, string>>} response received to compare to fixture
114+
* @return {void} void
115+
*/
116+
export function assertBinary(response: Record<string, string>): void {
111117
expect(response.lunchBreak).to.equal(data.lunchBreak);
112118
expect(response["ce-type"]).to.equal(type);
113119
expect(response["ce-source"]).to.equal(source);
@@ -116,7 +122,13 @@ function assertBinary(response: Record<string, string>) {
116122
expect(response[`ce-${ext3Name}`]).to.deep.equal(ext3Value);
117123
}
118124

119-
function assertStructured(response: Record<string, Record<string, string>>) {
125+
/**
126+
* Verify the received structured answer compare to the original fixture message
127+
*
128+
* @param {Record<string, Record<string, string>>} response received to compare to fixture
129+
* @return {void} void
130+
*/
131+
export function assertStructured(response: Record<string, Record<string, string>>): void {
120132
expect(response.data.lunchBreak).to.equal(data.lunchBreak);
121133
expect(response.type).to.equal(type);
122134
expect(response.source).to.equal(source);

0 commit comments

Comments
 (0)