more tests things

This commit is contained in:
nora 2022-02-10 06:55:07 +01:00
parent a7dba08990
commit 1cb4e21691
14 changed files with 98 additions and 40 deletions

View file

@ -0,0 +1 @@
console.log('Passed :)');

View 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');

View 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');

View file

@ -0,0 +1 @@
export const sleep = (ms) => new Promise((res) => setTimeout(res, ms));