Skip to content

Commit d6f50e7

Browse files
authored
Ensure that event streaming tests write a valid stream (#917)
* Add valid response to not error in tests
1 parent bacbf8e commit d6f50e7

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ A breaking change will get clearly marked in this log.
66

77
## Unreleased
88

9+
### Fixed
10+
* Event streaming tests now pass on Node 20, which seems to have tighter conformance to the spec ([#917](https://github.com/stellar/js-stellar-sdk/pull/917)).
11+
912

1013
## [v11.2.1](https://github.com/stellar/js-stellar-sdk/compare/v11.2.0...v11.2.1)
1114

test/integration/client_headers_test.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ describe("integration tests: client headers", function (done) {
4444
let query = url.parse(request.url, true).query;
4545
expect(query["X-Client-Name"]).to.be.equal("js-stellar-sdk");
4646
expect(query["X-Client-Version"]).to.match(versionPattern);
47+
48+
// write a valid event stream so that we don't error prematurely
49+
response.writeHead(200, {
50+
"Content-Type": "text/event-stream",
51+
});
52+
response.write("retry: 10\nevent: close\ndata: byebye\n\n");
4753
response.end();
54+
4855
server.close(() => {
4956
closeStream();
5057
done();
@@ -62,11 +69,7 @@ describe("integration tests: client headers", function (done) {
6269
allowHttp: true,
6370
})
6471
.operations()
65-
.stream({
66-
onerror: (err) => {
67-
done(err);
68-
},
69-
});
72+
.stream({ onerror: (err) => done(err) });
7073
});
7174
});
7275
});

0 commit comments

Comments
 (0)