Skip to content

Commit

Permalink
Merge pull request #137 from dlozina-macrometa/JSDR-88
Browse files Browse the repository at this point in the history
JSDR 88
  • Loading branch information
dlozina-macrometa authored Feb 27, 2023
2 parents 07746cd + 6eb4836 commit 093aab1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ export class Connection {
} else {
body = String(body);
}
} else if ((path && path.includes("/streams")) === true) {
}
if ((path && path.includes("/streams")) === true) {
contentType = "application/json";
}

Expand Down
18 changes: 16 additions & 2 deletions src/test/28-manipulating-streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { C8Client } from "../jsC8";
import { Stream } from "../stream";
import * as dotenv from "dotenv";

// TODO : @VIKAS Update Test cases

describe("Manipulating streams", function () {
dotenv.config();
// create fabric takes 11s in a standard cluster
Expand Down Expand Up @@ -194,6 +192,22 @@ describe("Manipulating streams", function () {
// });
// });

describe("publish message to stream", async () => {
it("publishes message to stream", async () => {
const name = `stream${Date.now()}`;
stream = client.stream(name, false);
const response = await stream.createStream();
expect(response.error).to.be.false;
const messageResponse = await stream.publishMessage(
"Hello Macrometa stream!"
);
expect(messageResponse.code).to.equal(202);
expect(messageResponse.error).to.be.false;
const deleteStreamResponse = await stream.deleteStream();
expect(deleteStreamResponse.error).to.be.false;
});
});

describe("stream.websocket", function () {
let dcName: string;
let consumer: any;
Expand Down

0 comments on commit 093aab1

Please sign in to comment.