This commit is contained in:
jacob
2024-04-28 13:48:50 -05:00
parent 91b3768e37
commit 30230d49c3
6 changed files with 35 additions and 28 deletions

View File

@@ -8,15 +8,13 @@ describe('module-loading', () => {
const filename = Files.fmtFileName(name+'.'+extension);
expect(filename).toBe(name)
})
// todo: handle commands with multiple extensions
// it('should properly extract filename from file, nested multiple', () => {
// const extension = faker.system.fileExt()
// const extension2 = faker.system.fileExt()
// const name = faker.system.fileName({ extensionCount: 0 })
// const filename = Files.fmtFileName(name+'.'+extension+'.'+extension2);
// console.log(filename, name)
// expect(filename).toBe(name)
//
// })
it('should get the filename of the commandmodule (linux)', () => {
const fname = "///home/pooba/Projects/sern/halibu/dist/commands/ping.js"
expect(Files.parseCallsite(fname)).toBe("ping")
})
it('should get the filename of the commandmodule (windows)', () => {
//const fname = "C:\\pooba\\Projects\\sern\\halibu\\dist\\commands\\ping.js"
//expect(Files.parseCallsite(fname)).toBe("ping")
})
})

View File

@@ -2,10 +2,9 @@ import { SpyInstance, afterAll, beforeEach, describe, expect, it, vi } from 'vit
import { CoreContainer } from '../../src/core/ioc/container';
import { DefaultLogging } from '../../src/core';
import { faker } from '@faker-js/faker';
import { commandModule } from '../../src';
import { commandModule, CommandType } from '../../src';
import * as Id from '../../src/core/id';
import { CommandMeta } from '../../src/types/core-modules';
describe('services', () => {
//@ts-ignore
let container: CoreContainer<Dependencies>;
@@ -23,9 +22,9 @@ describe('services', () => {
it('module-store.ts', async () => {
function createRandomCommandModules() {
return commandModule({
type: faker.number.int({ min: 1 << 0, max: 1 << 10 }),
type: CommandType.Slash,
description: faker.string.alpha(),
name: faker.string.alpha(),
name: faker.string.alpha({ length: { min: 5, max: 10 }}),
execute: () => {},
});
}