Skip to content

Commit 7aa4a20

Browse files
authored
refactor: reorganise test files and standardise naming convention (#191)
* refactor(tests): relocate tests to sit alongside implementations Move all test files from src/tests/ to respective implementation directories: - Array, TF-IDF index tests to src/utils/ - Base, StackOne toolset tests to src/toolsets/ - RequestBuilder tests to src/modules/ - Feedback tool tests to src/tools/ - Tool, meta-tools, json-schema tests to src/ - RPC client test remains in src/ Update all relative imports to reflect new file locations. This makes the test file sit horizontally next to its implementation, improving discoverability and maintainability. All tests pass and types are correct. * refactor(tests): rename .spec.ts files to .test.ts Rename all test files from .spec.ts to .test.ts convention for consistency with industry standards. Test files now use a uniform naming scheme across the entire project. * refactor(config): update vitest configuration for .test.ts naming Update vitest.config.ts to reference .test.ts files instead of .spec.ts: - Change include patterns from *.spec.ts to *.test.ts - Simplify coverage exclude patterns by removing deprecated patterns - Update typecheck include patterns to match new naming convention - Fix outdated path reference in exclude list * refactor(skills): update test file naming from .spec.ts to .test.ts Update Claude Code skill documentation to reflect the new .test.ts naming convention for test files: - Update typescript-testing skill globs from *.spec.ts to *.test.ts - Update example commands to use .test.ts file paths - Remove outdated pnpm test:unit command reference - Update development-workflow skill with new naming convention
1 parent b6af300 commit 7aa4a20

File tree

16 files changed

+24
-26
lines changed

16 files changed

+24
-26
lines changed

.claude/skills/development-workflow/SKILL.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ This skill provides all commands and best practices for building, developing, an
1919
## Testing
2020

2121
- `pnpm test` - Run all tests (unit, examples, scripts)
22-
- `pnpm test:unit` - Run only unit tests
23-
- `pnpm vitest src/path/to/file.spec.ts` - Run a specific test file
22+
- `pnpm vitest src/path/to/file.test.ts` - Run a specific test file
2423
- `pnpm vitest -t "test name"` - Run tests matching a pattern
2524

2625
## Code Quality

.claude/skills/typescript-testing/SKILL.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: typescript-testing
33
description: Use when writing or running tests. Covers Vitest commands, MSW HTTP mocking, fs-fixture for file system tests. (project)
4-
globs: "*.spec.ts"
4+
globs: "*.test.ts"
55
alwaysApply: false
66
---
77

@@ -13,8 +13,7 @@ This skill guides testing practices for the StackOne SDK using Vitest test runne
1313

1414
The project uses **Vitest** as the test runner. Run tests with:
1515
- `pnpm test` - Run all tests (unit, examples, scripts)
16-
- `pnpm test:unit` - Run only unit tests
17-
- `pnpm vitest src/path/to/file.spec.ts` - Run a specific test file
16+
- `pnpm vitest src/path/to/file.test.ts` - Run a specific test file
1817
- `pnpm vitest -t "test name"` - Run tests matching a pattern
1918

2019
### Vitest Globals
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as StackOneAI from '../index';
1+
import * as StackOneAI from './index';
22

33
describe('Module Exports', () => {
44
it('should export main classes and utilities', () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { http, HttpResponse } from 'msw';
22
import { server } from '../../mocks/node';
3-
import { RequestBuilder } from '../modules/requestBuilder';
43
import { type HttpExecuteConfig, ParameterLocation } from '../types';
54
import { StackOneAPIError } from '../utils/errors';
5+
import { RequestBuilder } from './requestBuilder';
66

77
describe('RequestBuilder', () => {
88
let builder: RequestBuilder;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { jsonSchema } from 'ai';
22
import type { JSONSchema7 } from 'json-schema';
3-
import { StackOneTool } from '../tool';
3+
import { StackOneTool } from './tool';
44

55
describe('Schema Validation', () => {
66
describe('Array Items in Schema', () => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { assert } from 'vitest';
2-
import { BaseTool, type MetaToolSearchResult, Tools } from '../tool';
3-
import { ParameterLocation } from '../types';
2+
import { BaseTool, type MetaToolSearchResult, Tools } from './tool';
3+
import { ParameterLocation } from './types';
44

55
// Create mock tools for testing
66
const createMockTools = (): BaseTool[] => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ChatCompletionFunctionTool } from 'openai/resources/chat/completions';
22
import { assertType, test } from 'vitest';
3-
import { BaseTool, Tools } from '../tool';
4-
import type { AISDKToolResult } from '../types';
3+
import { BaseTool, Tools } from './tool';
4+
import type { AISDKToolResult } from './types';
55

66
const tool = new BaseTool(
77
'test_tool',
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { BaseTool, StackOneTool, Tools } from '../tool';
2-
import { type ExecuteConfig, ParameterLocation, type ToolParameters } from '../types';
3-
import { StackOneAPIError } from '../utils/errors';
1+
import { BaseTool, StackOneTool, Tools } from './tool';
2+
import { type ExecuteConfig, ParameterLocation, type ToolParameters } from './types';
3+
import { StackOneAPIError } from './utils/errors';
44

55
// Create a mock tool for testing
66
const createMockTool = (headers?: Record<string, string>): BaseTool => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { http, HttpResponse } from 'msw';
22
import { server } from '../../mocks/node';
3-
import { createFeedbackTool } from '../tools/feedback';
43
import { StackOneError } from '../utils/errors';
4+
import { createFeedbackTool } from './feedback';
55

66
interface FeedbackResultItem {
77
account_id: string;

0 commit comments

Comments
 (0)