mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-15 04:05:03 +01:00
more tests things
This commit is contained in:
parent
a7dba08990
commit
1cb4e21691
14 changed files with 98 additions and 40 deletions
1
test-js/src/dummy-test.js
Normal file
1
test-js/src/dummy-test.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
console.log('Passed :)');
|
||||
15
test-js/src/open-channel.js
Normal file
15
test-js/src/open-channel.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { connect } from 'amqplib';
|
||||
import { sleep } from './utils/utils.js';
|
||||
|
||||
const connection = await connect('amqp://localhost');
|
||||
|
||||
const channel = await connection.createChannel();
|
||||
|
||||
console.log('Successfully opened channel');
|
||||
|
||||
await sleep(100_000);
|
||||
|
||||
await channel.close();
|
||||
await connection.close();
|
||||
|
||||
console.log('Successfully shut down connection');
|
||||
14
test-js/src/send-single-message.js
Normal file
14
test-js/src/send-single-message.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { connect } from 'amqplib';
|
||||
|
||||
const connection = await connect('amqp://localhost');
|
||||
|
||||
const channel = await connection.createChannel();
|
||||
|
||||
channel.publish('exchange-1', 'queue-1', Buffer.from('hello'));
|
||||
|
||||
console.log('Published message');
|
||||
|
||||
await channel.close();
|
||||
await connection.close();
|
||||
|
||||
console.log('Successfully shut down connection');
|
||||
1
test-js/src/utils/utils.js
Normal file
1
test-js/src/utils/utils.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
||||
Loading…
Add table
Add a link
Reference in a new issue