Publish on 'test' channel (index 3) by default (#10)
CI / build + unit (push) Successful in 34s
CI / build + unit (push) Successful in 34s
This commit was merged in pull request #10.
This commit is contained in:
@@ -295,11 +295,11 @@ describe('MeshService connect', () => {
|
||||
});
|
||||
|
||||
describe('MeshService send', () => {
|
||||
it('sends on the test channel (index 2) by default, never primary', async () => {
|
||||
it('sends on the test channel (index 3) by default, never primary', async () => {
|
||||
const bridge = await startBridge();
|
||||
process.env.MESH_HOST = '127.0.0.1';
|
||||
process.env.MESH_PORT = String(bridge.port);
|
||||
delete process.env.MESH_SEND_CHANNEL; // default path: "testowy" (index 2)
|
||||
delete process.env.MESH_SEND_CHANNEL; // default path: "test" (index 3)
|
||||
const svc = new MeshService();
|
||||
try {
|
||||
svc.onModuleInit();
|
||||
@@ -309,7 +309,7 @@ describe('MeshService send', () => {
|
||||
|
||||
const out: Uint8Array[] = [];
|
||||
bridge.sockets[0].on('data', (c) => out.push(c));
|
||||
const id = await svc.sendText(42, 'hello testowy');
|
||||
const id = await svc.sendText(42, 'hello test');
|
||||
expect(id).toBeGreaterThan(0);
|
||||
|
||||
const readOutbound = (): P.Mesh.MeshPacket | undefined => {
|
||||
@@ -331,7 +331,7 @@ describe('MeshService send', () => {
|
||||
|
||||
await waitFor(() => readOutbound() !== undefined);
|
||||
const pkt = readOutbound()!;
|
||||
expect(pkt.channel).toBe(2); // "testowy" — never the primary channel (0)
|
||||
expect(pkt.channel).toBe(3); // "test" — never the primary channel (0)
|
||||
expect(pkt.to).toBe(42);
|
||||
const decoded =
|
||||
pkt.payloadVariant?.case === 'decoded'
|
||||
@@ -339,7 +339,7 @@ describe('MeshService send', () => {
|
||||
: undefined;
|
||||
expect(
|
||||
new TextDecoder().decode(decoded?.payload ?? new Uint8Array()),
|
||||
).toBe('hello testowy');
|
||||
).toBe('hello test');
|
||||
} finally {
|
||||
delete process.env.MESH_SEND_CHANNEL;
|
||||
svc.onModuleDestroy();
|
||||
@@ -537,13 +537,13 @@ describe('MeshService message history', () => {
|
||||
() => bridge.sockets.length === 1 && svc.status().connected,
|
||||
);
|
||||
|
||||
const id = await svc.sendText(42, 'hello testowy');
|
||||
const id = await svc.sendText(42, 'hello test');
|
||||
expect(svc.messages()[0]).toMatchObject({
|
||||
id,
|
||||
dir: 'tx',
|
||||
to: 42,
|
||||
text: 'hello testowy',
|
||||
channel: 2,
|
||||
text: 'hello test',
|
||||
channel: 3,
|
||||
status: 'pending',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user