Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions packages/spec/src/api/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ describe('ExportRequestSchema', () => {
const request = ExportRequestSchema.parse({
object: 'account',
fields: ['name', 'email'],
filters: ['status', '=', 'active'],
where: { status: 'active' },
format: 'xlsx',
});

expect(request.format).toBe('xlsx');
expect(request.filters).toBeDefined();
expect(request.where).toBeDefined();
});
});

Expand Down
10 changes: 5 additions & 5 deletions packages/spec/src/api/endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import {
ApiEndpointSchema,
RateLimitSchema,
ApiMappingSchema,
HttpMethod,
ApiEndpoint,
} from '../system/api.zod';
} from './endpoint.zod';
import { HttpMethod } from './router.zod';

describe('HttpMethod', () => {
it('should accept valid HTTP methods', () => {
const validMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
const validMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'];

validMethods.forEach(method => {
expect(() => HttpMethod.parse(method)).not.toThrow();
});
});

it('should reject invalid HTTP methods', () => {
expect(() => HttpMethod.parse('HEAD')).toThrow();
expect(() => HttpMethod.parse('OPTIONS')).toThrow();
expect(() => HttpMethod.parse('TRACE')).toThrow();
expect(() => HttpMethod.parse('CONNECT')).toThrow();
expect(() => HttpMethod.parse('get')).toThrow();
});
});
Expand Down
10 changes: 8 additions & 2 deletions packages/spec/src/data/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ describe('ObjectCapabilities', () => {
expect(result.searchable).toBe(true);
expect(result.apiEnabled).toBe(true);
expect(result.files).toBe(false);
expect(result.feedEnabled).toBe(false);
expect(result.feeds).toBe(false);
expect(result.activities).toBe(false);
expect(result.trash).toBe(true);
expect(result.mru).toBe(true);
expect(result.clone).toBe(true);
});

it('should accept custom capability values', () => {
Expand All @@ -19,8 +22,11 @@ describe('ObjectCapabilities', () => {
searchable: false,
apiEnabled: true,
files: true,
feedEnabled: true,
feeds: true,
activities: false,
trash: false,
mru: true,
clone: true,
};

const result = ObjectCapabilities.parse(capabilities);
Expand Down
Loading
Loading