Improvements to tests and from testing

- Moved OP25 start outside of PDAB start callback
- Added more logging
- Set the pdabProcess variable to false when closing the discord client
- Update test variable names
- Added new WIP pdabWrappers tests to test the full wrappers as the client would
This commit is contained in:
Logan Cusano
2024-04-28 03:21:03 -04:00
parent bf69e93e29
commit a353b9adbb
4 changed files with 56 additions and 27 deletions

View File

@@ -1,8 +1,5 @@
// Import necessary modules for testing
import { use, expect } from 'chai'
import chaiHttp from 'chai-http'
const chai = use(chaiHttp)
import { expect } from 'chai'
import io from 'socket.io-client';
const ioClient = io;
@@ -35,7 +32,7 @@ describe('Socket Server Tests', done => {
});
it('Should open a socket server and callback when the client is connected and ready', done => {
const clientId = process.env.DISCORD_CLIENT_ID;
const clientId = process.env.TEST_CLIENT_TOKEN;
const callback = () => {
done();
@@ -130,19 +127,9 @@ describe('Socket Server Tests', done => {
});
describe('Socket Client & Python IPC Tests', done => {
after(async () => {
// Any teardown needed after tests
try {
await socket.close();
}
catch {
console.log("Socket already closed");
}
});
it('Should open a socket server and callback when the client is connected and ready', done => {
let clientConnected = false;
const clientId = process.env.DISCORD_CLIENT_ID;
const clientId = process.env.TEST_CLIENT_TOKEN;
const callback = () => {
clientConnected = true;
@@ -165,13 +152,6 @@ describe('Socket Client & Python IPC Tests', done => {
expect(status).to.be.true;
});
it('Should have opened OP25', async () => {
// Assuming your server is running on localhost:8081
const res = await chai.request('http://localhost:8081').get('/');
expect(res).to.have.status(200); // Assuming 200 is the expected status code
// Add more assertions if needed
});
it('Should emit command for and return status if connected to voice channel', async () => {
// Simulate emitting 'check_discord_vc_connected' event
const isConnected = await checkIfConnectedToVC(process.env.TEST_GUILD_ID);