chore: remove admin and agent pipeline remnants
This commit is contained in:
@@ -1,77 +1,15 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { AIEventInputSchema, ProjectInputSchema } from './validations';
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { ProjectInputSchema } from "./validations";
|
||||
|
||||
describe('AIEventInputSchema', () => {
|
||||
const validEvent = {
|
||||
title: 'GPT-4 发布',
|
||||
eventDate: '2023-03-14T00:00:00Z',
|
||||
description: 'OpenAI 发布多模态大语言模型',
|
||||
imageUrl: 'https://example.com/gpt4.jpg',
|
||||
};
|
||||
|
||||
it('should validate valid event', () => {
|
||||
expect(() => AIEventInputSchema.parse(validEvent)).not.toThrow();
|
||||
});
|
||||
|
||||
it('should accept event with optional English fields', () => {
|
||||
const eventWithEn = {
|
||||
...validEvent,
|
||||
titleEn: 'GPT-4 Release',
|
||||
descriptionEn: 'OpenAI launches multimodal LLM',
|
||||
sourceUrl: 'https://openai.com/blog/gpt-4',
|
||||
};
|
||||
expect(() => AIEventInputSchema.parse(eventWithEn)).not.toThrow();
|
||||
});
|
||||
|
||||
it('should reject empty title', () => {
|
||||
expect(() => AIEventInputSchema.parse({ ...validEvent, title: '' }))
|
||||
.toThrow();
|
||||
});
|
||||
|
||||
it('should reject title exceeding 200 characters', () => {
|
||||
const longTitle = 'A'.repeat(201);
|
||||
expect(() => AIEventInputSchema.parse({ ...validEvent, title: longTitle }))
|
||||
.toThrow();
|
||||
});
|
||||
|
||||
it('should reject description shorter than 10 characters', () => {
|
||||
expect(() => AIEventInputSchema.parse({ ...validEvent, description: '太短' }))
|
||||
.toThrow();
|
||||
});
|
||||
|
||||
it('should reject description exceeding 500 characters', () => {
|
||||
const longDesc = 'A'.repeat(501);
|
||||
expect(() => AIEventInputSchema.parse({ ...validEvent, description: longDesc }))
|
||||
.toThrow();
|
||||
});
|
||||
|
||||
it('should reject invalid eventDate format', () => {
|
||||
expect(() => AIEventInputSchema.parse({ ...validEvent, eventDate: '2023-03-14' }))
|
||||
.toThrow();
|
||||
});
|
||||
|
||||
it('should reject invalid imageUrl', () => {
|
||||
expect(() => AIEventInputSchema.parse({ ...validEvent, imageUrl: 'not-a-url' }))
|
||||
.toThrow();
|
||||
});
|
||||
|
||||
it('should reject invalid sourceUrl format', () => {
|
||||
expect(() => AIEventInputSchema.parse({
|
||||
...validEvent,
|
||||
sourceUrl: 'not-a-url'
|
||||
})).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('ProjectInputSchema', () => {
|
||||
describe("ProjectInputSchema", () => {
|
||||
const baseProjectInput = {
|
||||
name: 'Agent Park',
|
||||
description: 'A curated list of practical AI agent tools.',
|
||||
tags: [{ name: 'ai-agent' }],
|
||||
links: [{ type: 'GITHUB' as const, url: 'https://github.com/example/repo' }],
|
||||
name: "Agent Park",
|
||||
description: "A curated list of practical AI agent tools.",
|
||||
tags: [{ name: "ai-agent" }],
|
||||
links: [{ type: "GITHUB" as const, url: "https://github.com/example/repo" }],
|
||||
};
|
||||
|
||||
it('should allow more than 10 tags', () => {
|
||||
it("should allow more than 10 tags", () => {
|
||||
const manyTags = Array.from({ length: 20 }, (_, index) => ({
|
||||
name: `tag-${index + 1}`,
|
||||
}));
|
||||
@@ -84,7 +22,7 @@ describe('ProjectInputSchema', () => {
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('should still require at least one tag', () => {
|
||||
it("should still require at least one tag", () => {
|
||||
expect(() =>
|
||||
ProjectInputSchema.parse({
|
||||
...baseProjectInput,
|
||||
|
||||
Reference in New Issue
Block a user