mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
Add Gemini Pro-powered PR analysis that generates targeted QA guides from the full PR thread (description, comments, screenshots, diff). The analyze-pr job runs on lightweight ubuntu before recordings start, producing qa-guide-before.json and qa-guide-after.json that are downloaded by recording jobs to produce more focused test steps. Graceful fallback: if analysis fails, recordings proceed without guides.
85 lines
2.8 KiB
TypeScript
85 lines
2.8 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { extractMediaUrls } from './qa-analyze-pr'
|
|
|
|
describe('extractMediaUrls', () => {
|
|
it('extracts markdown image URLs', () => {
|
|
const text = ''
|
|
expect(extractMediaUrls(text)).toEqual(['https://example.com/image.png'])
|
|
})
|
|
|
|
it('extracts multiple markdown images', () => {
|
|
const text = [
|
|
'',
|
|
'Some text',
|
|
''
|
|
].join('\n')
|
|
expect(extractMediaUrls(text)).toEqual([
|
|
'https://example.com/before.png',
|
|
'https://example.com/after.jpg'
|
|
])
|
|
})
|
|
|
|
it('extracts raw URLs with media extensions', () => {
|
|
const text = 'Check this: https://cdn.example.com/demo.mp4 for details'
|
|
expect(extractMediaUrls(text)).toEqual(['https://cdn.example.com/demo.mp4'])
|
|
})
|
|
|
|
it('extracts GitHub user-attachments URLs', () => {
|
|
const text =
|
|
'https://github.com/user-attachments/assets/abc12345-6789-0def-1234-567890abcdef'
|
|
expect(extractMediaUrls(text)).toEqual([
|
|
'https://github.com/user-attachments/assets/abc12345-6789-0def-1234-567890abcdef'
|
|
])
|
|
})
|
|
|
|
it('extracts private-user-images URLs', () => {
|
|
const text =
|
|
'https://private-user-images.githubusercontent.com/12345/abcdef-1234?jwt=token123'
|
|
expect(extractMediaUrls(text)).toEqual([
|
|
'https://private-user-images.githubusercontent.com/12345/abcdef-1234?jwt=token123'
|
|
])
|
|
})
|
|
|
|
it('extracts URLs with query parameters', () => {
|
|
const text = 'https://example.com/image.png?w=800&h=600'
|
|
expect(extractMediaUrls(text)).toEqual([
|
|
'https://example.com/image.png?w=800&h=600'
|
|
])
|
|
})
|
|
|
|
it('deduplicates URLs', () => {
|
|
const text = [
|
|
'',
|
|
'',
|
|
'Also https://example.com/same.png'
|
|
].join('\n')
|
|
expect(extractMediaUrls(text)).toEqual(['https://example.com/same.png'])
|
|
})
|
|
|
|
it('returns empty array for empty input', () => {
|
|
expect(extractMediaUrls('')).toEqual([])
|
|
})
|
|
|
|
it('returns empty array for text with no media URLs', () => {
|
|
expect(extractMediaUrls('Just some text without any URLs')).toEqual([])
|
|
})
|
|
|
|
it('handles mixed media types', () => {
|
|
const text = [
|
|
'',
|
|
'Video: https://example.com/demo.webm',
|
|
''
|
|
].join('\n')
|
|
const urls = extractMediaUrls(text)
|
|
expect(urls).toContain('https://example.com/screenshot.png')
|
|
expect(urls).toContain('https://example.com/demo.webm')
|
|
expect(urls).toContain('https://example.com/animation.gif')
|
|
})
|
|
|
|
it('ignores non-http URLs in markdown', () => {
|
|
const text = ''
|
|
expect(extractMediaUrls(text)).toEqual([])
|
|
})
|
|
})
|