ai
Version:
AI SDK by Vercel - The AI Toolkit for TypeScript and JavaScript
16 lines (13 loc) • 503 B
text/typescript
import { dataContentSchema } from './data-content';
import { describe, it, expect } from 'vitest';
describe('dataContentSchema', () => {
it('should validate a Buffer', () => {
const buffer = Buffer.from('Hello, world!');
const result = dataContentSchema.parse(buffer);
expect(result).toEqual(buffer);
});
it('should reject a non-matching object', () => {
const nonMatchingObject = { foo: 'bar' };
expect(() => dataContentSchema.parse(nonMatchingObject)).toThrow();
});
});