Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .claude/skills/development-workflow/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ This skill provides all commands and best practices for building, developing, an
## Testing

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

## Code Quality
Expand Down
5 changes: 2 additions & 3 deletions .claude/skills/typescript-testing/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: typescript-testing
description: Use when writing or running tests. Covers Vitest commands, MSW HTTP mocking, fs-fixture for file system tests. (project)
globs: "*.spec.ts"
globs: "*.test.ts"
alwaysApply: false
---

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

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

### Vitest Globals
Expand Down
2 changes: 1 addition & 1 deletion src/tests/exports.spec.ts → src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as StackOneAI from '../index';
import * as StackOneAI from './index';

describe('Module Exports', () => {
it('should export main classes and utilities', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { http, HttpResponse } from 'msw';
import { server } from '../../mocks/node';
import { RequestBuilder } from '../modules/requestBuilder';
import { type HttpExecuteConfig, ParameterLocation } from '../types';
import { StackOneAPIError } from '../utils/errors';
import { RequestBuilder } from './requestBuilder';

describe('RequestBuilder', () => {
let builder: RequestBuilder;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { jsonSchema } from 'ai';
import type { JSONSchema7 } from 'json-schema';
import { StackOneTool } from '../tool';
import { StackOneTool } from './tool';

describe('Schema Validation', () => {
describe('Array Items in Schema', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert } from 'vitest';
import { BaseTool, type MetaToolSearchResult, Tools } from '../tool';
import { ParameterLocation } from '../types';
import { BaseTool, type MetaToolSearchResult, Tools } from './tool';
import { ParameterLocation } from './types';

// Create mock tools for testing
const createMockTools = (): BaseTool[] => {
Expand Down
4 changes: 2 additions & 2 deletions src/tests/tool.test-d.ts → src/tool.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ChatCompletionFunctionTool } from 'openai/resources/chat/completions';
import { assertType, test } from 'vitest';
import { BaseTool, Tools } from '../tool';
import type { AISDKToolResult } from '../types';
import { BaseTool, Tools } from './tool';
import type { AISDKToolResult } from './types';

const tool = new BaseTool(
'test_tool',
Expand Down
6 changes: 3 additions & 3 deletions src/tests/tool.spec.ts → src/tool.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BaseTool, StackOneTool, Tools } from '../tool';
import { type ExecuteConfig, ParameterLocation, type ToolParameters } from '../types';
import { StackOneAPIError } from '../utils/errors';
import { BaseTool, StackOneTool, Tools } from './tool';
import { type ExecuteConfig, ParameterLocation, type ToolParameters } from './types';
import { StackOneAPIError } from './utils/errors';

// Create a mock tool for testing
const createMockTool = (headers?: Record<string, string>): BaseTool => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { http, HttpResponse } from 'msw';
import { server } from '../../mocks/node';
import { createFeedbackTool } from '../tools/feedback';
import { StackOneError } from '../utils/errors';
import { createFeedbackTool } from './feedback';

interface FeedbackResultItem {
account_id: string;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/base.spec.ts → src/toolsets/base.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ToolSet } from '../toolsets/base';
import { ToolSet } from './base';

// Create a concrete implementation of the abstract ToolSet class for testing
class TestToolSet extends ToolSet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { Hono } from 'hono';
import { z } from 'zod';
import { server as mswServer } from '../../mocks/node';
import { ToolSet } from '../toolsets/base';
import { StackOneToolSet } from '../toolsets/stackone';
import { ToolSet } from './base';
import { StackOneToolSet } from './stackone';

// Bun runtime types for test environment
declare const Bun: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ToolSetConfigError } from '../toolsets/base';
import { StackOneToolSet } from '../toolsets/stackone';
import { ToolSetConfigError } from './base';
import { StackOneToolSet } from './stackone';

describe('StackOneToolSet', () => {
beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/array.spec.ts → src/utils/array.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toArray } from '../utils/array';
import { toArray } from './array';

describe('toArray', () => {
it.each([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TfidfIndex } from '../utils/tfidf-index';
import { TfidfIndex } from './tfidf-index';

describe('TF-IDF Index - Core Functionality', () => {
test('ranks documents by cosine similarity with tf-idf weighting', () => {
Expand Down
8 changes: 4 additions & 4 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ export default defineConfig({
provider: 'v8',
reporter: ['text', 'json', 'json-summary', 'html'],
include: ['src/**/*.ts', 'examples/**/*.ts'],
exclude: ['**/*.spec.ts', '**/*.test.ts', '**/*.test-d.ts', '**/tests/**'],
exclude: ['**/*.test.ts', '**/*.test-d.ts'],
},
projects: [
{
extends: true,
test: {
name: 'root',
root: '.',
include: ['src/**/*.spec.ts', 'scripts/**/*.spec.ts'],
exclude: ['node_modules', 'dist', 'examples', 'src/toolsets/tests/stackone.mcp-fetch.spec.ts'],
include: ['src/**/*.test.ts', 'scripts/**/*.test.ts'],
exclude: ['node_modules', 'dist', 'examples', 'src/toolsets/stackone.mcp-fetch.test.ts'],
setupFiles: ['./vitest.setup.ts'],
typecheck: {
enabled: true,
include: ['src/**/*.spec.ts', 'src/**/*.test-d.ts'],
include: ['src/**/*.test.ts', 'src/**/*.test-d.ts'],
},
},
},
Expand Down
Loading