Skip to content

test: add basic schema validation test suite#76

Open
dionlow wants to merge 1 commit into
dl-local-simple-testfrom
dl-local-simple-test-2
Open

test: add basic schema validation test suite#76
dionlow wants to merge 1 commit into
dl-local-simple-testfrom
dl-local-simple-test-2

Conversation

@dionlow

@dionlow dionlow commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

Summary

  • Add comprehensive schema validation test suite with 48 tests
  • Export all Zod schemas from aisdk adapter for testing
  • Add test:schema script to test package.json

Test Coverage

Tests all 8 Ampersand AI SDK tools:

  • ✅ Write operations (createRecord, updateRecord)
  • ✅ Connection management (checkConnection)
  • ✅ Installation management (checkInstallation, createInstallation)
  • ✅ OAuth (startOAuth)
  • ✅ API requests (sendRequest, sendReadRequest)

Test Results

Total tests: 48
Passed: 48
Failed: 0
Success rate: 100.0%

Benefits

  • Fast execution (no AI or API calls)
  • No OpenAI credits required
  • Tests both valid and invalid inputs

How to Run

pnpm --filter ai-e2e-test test:schema

Stack

This PR stacks on top of dl-local-simple-test

- Create ai-e2e-schema-validation.ts with 48 schema tests
- Export all Zod schemas from aisdk adapter for testing
- Add test:schema script to test package.json
- Tests cover all 8 tools: write operations, connection/installation management, OAuth, and API requests
- 100% test pass rate with no AI or API calls required

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dionlow dionlow changed the title test: add comprehensive schema validation test suite test: add basic schema validation test suite Dec 3, 2025

@caiopizzol caiopizzol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just some minors

}
}

function expectValid(schema: any, data: any) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schema: any loses type safety - could be z.ZodTypeAny, but not a big deal

Comment thread test/package.json
@@ -6,7 +6,7 @@
"scripts": {
"test": "tsx ai-e2e-vercel-ai.ts",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script references ai-e2e-vercel-ai.ts (that doesn't exist)

Comment thread sdk/lib/adapters/aisdk.ts
});

// Re-export schemas for testing and validation
export {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minot, but once exported from @amp-labs/ai/aisdk, these become part of the public API - any change, renaming will cause a breaking change to the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants