first test passes uwu

This commit is contained in:
nora 2022-02-22 13:15:59 +01:00
parent 6f5fef2f23
commit 9a819bc3f4
7 changed files with 30 additions and 24 deletions

View file

@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"fmt": "prettier -w .",
"test": "node test-all.js"
"test": "prettier -c . && node test-all.js"
},
"dependencies": {
"@types/amqplib": "^0.8.2",

View file

@ -1,4 +1,4 @@
import {connectAmqp, sleep} from './utils/utils.js';
import { connectAmqp, sleep } from './utils/utils.js';
const connection = await connectAmqp();
@ -6,8 +6,6 @@ const channel = await connection.createChannel();
console.log('Successfully opened channel');
await sleep(100_000);
await channel.close();
await connection.close();

View file

@ -1,4 +1,4 @@
import {connectAmqp} from "./utils/utils.js";
import { connectAmqp } from './utils/utils.js';
const connection = await connectAmqp();

View file

@ -1,17 +1,18 @@
import {connect} from "amqplib";
import { connect } from 'amqplib';
export const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
export const connectAmqp = async () => {
return connect({
protocol: 'amqp',
hostname: 'localhost',
port: 5672,
username: 'admin',
password: '',
frameMax: 238556565673829,
}, {
});
}
return connect(
{
protocol: 'amqp',
hostname: 'localhost',
port: 5672,
username: 'admin',
password: '',
frameMax: 0,
channelMax: 1000,
},
{}
);
};