-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: stdio transport not sending newline, add test
- Loading branch information
Showing
8 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { describe, test, expect } from 'vitest'; | ||
import stream from 'node:stream'; | ||
import { StreamTransport } from './stream'; | ||
import { waitForMessage } from './util'; | ||
|
||
describe('sending and receiving across node streams works', () => { | ||
test('basic send/receive', async () => { | ||
const clientToServer = new stream.PassThrough(); | ||
const serverToClient = new stream.PassThrough(); | ||
const serverTransport = new StreamTransport('SERVER', clientToServer, serverToClient); | ||
const clientTransport = new StreamTransport('client', serverToClient, clientToServer); | ||
|
||
const msg = { | ||
msg: 'cool', | ||
test: 123, | ||
}; | ||
|
||
const p = waitForMessage(serverTransport) | ||
clientTransport.send({ | ||
id: '1', | ||
from: 'client', | ||
to: 'SERVER', | ||
serviceName: 'test', | ||
procedureName: 'test', | ||
payload: msg, | ||
}); | ||
|
||
await expect(p).resolves.toStrictEqual(msg); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters