Update util to check if folder exists

This commit is contained in:
Vylpes 2021-02-07 14:12:56 +00:00
parent bebaf30d16
commit c816f182b2
5 changed files with 95 additions and 72 deletions

View file

@ -1,5 +1,6 @@
const util = require('../../../src/client/util');
const { readFileSync, read } = require('fs');
const { test, expect } = require('@jest/globals');
// Mocks
jest.mock('discord.js');
@ -74,4 +75,12 @@ describe('util.loadCommand', () => {
expect(res.valid).toBe(false);
expect(res.message).toBe("test requires tester in it's configuration");
});
test('Should throw error if command folder does not exist', () => {
client.config.commands = "falsefile";
let res = instance.loadCommand('testing', 'param1', message);
expect(res.valid).toBe(false);
expect(res.message).toBe('Command folder does not exist');
});
});