UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

39 lines (31 loc) 1.27 kB
import { diskUtil } from '@sprucelabs/spruce-skill-utils' import { test, assert } from '@sprucelabs/test-utils' import ParentTestFinder from '../../features/error/ParentTestFinder' import AbstractCliTest from '../../tests/AbstractCliTest' export default class ParentTestFinderTest extends AbstractCliTest { @test() protected static async canCreateFinder() { const finder = new ParentTestFinder(this.cwd) assert.isTruthy(finder) } @test() protected static async canFindAbstractTests() { await this.copyTestFiles() const testFinder = new ParentTestFinder(this.cwd) const matches = await testFinder.findAbstractTests() assert.isLength(matches, 3) assert.doesInclude(matches, { name: 'AbstractTest', path: this.resolvePath('src', 'AbstractTest.ts'), }) assert.doesInclude(matches, { name: 'AbstractBananaTestDifferentThanFileName', path: this.resolvePath('src', 'deeper', 'AbstractBananaTest.ts'), }) } private static async copyTestFiles() { const source = this.resolveTestPath('abstract_tests') const destination = this.resolvePath('src') await diskUtil.copyDir(source, destination) } }