-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-e2e.mjs
More file actions
90 lines (76 loc) · 3.26 KB
/
test-e2e.mjs
File metadata and controls
90 lines (76 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// End-to-end test for the application
import { extractStoryReferences, generateStoryBreakdownWithReferences } from './app/actions/story/index.js';
const testStory = `The Three Little Pigs
Once upon a time, there were three little pigs who decided to build their own houses.
The first pig built his house from straw, the second from sticks, and the third from bricks.
Along came a big bad wolf who wanted to eat the pigs. He blew down the straw house,
then the stick house, but couldn't blow down the brick house.`;
async function testStoryFlow() {
console.log('🧪 Testing Story Flow...\n');
try {
// Step 1: Extract references
console.log('1️⃣ Extracting references from story...');
const extractResult = await extractStoryReferences(
testStory,
'nolan',
'Dark and suspenseful tone'
);
if (!extractResult.success) {
throw new Error(`Reference extraction failed: ${extractResult.error}`);
}
console.log('✅ References extracted:');
console.log(` - Characters: ${extractResult.data.characters.length}`);
console.log(` - Locations: ${extractResult.data.locations.length}`);
console.log(` - Props: ${extractResult.data.props.length}\n`);
// Step 2: Generate breakdown with references
console.log('2️⃣ Generating breakdown with references...');
const breakdownResult = await generateStoryBreakdownWithReferences(
testStory,
'nolan',
'Dark and suspenseful tone',
extractResult.data,
{ enabled: false },
{ includeCameraStyle: true, includeColorPalette: true },
'ai-suggested',
4
);
if (!breakdownResult.success) {
throw new Error(`Breakdown generation failed: ${breakdownResult.error}`);
}
console.log('✅ Breakdown generated:');
console.log(` - Chapters: ${breakdownResult.data.chapters?.length || 0}`);
console.log(` - Chapter breakdowns: ${breakdownResult.data.chapterBreakdowns?.length || 0}\n`);
// Verify chapter details
if (breakdownResult.data.chapterBreakdowns && breakdownResult.data.chapterBreakdowns.length > 0) {
const firstChapter = breakdownResult.data.chapterBreakdowns[0];
console.log('📊 First chapter details:');
console.log(` - Shots: ${firstChapter.shots?.length || 0}`);
console.log(` - Character refs: ${firstChapter.characterReferences?.length || 0}`);
console.log(` - Location refs: ${firstChapter.locationReferences?.length || 0}`);
console.log(` - Prop refs: ${firstChapter.propReferences?.length || 0}`);
}
console.log('\n✅ Story flow test completed successfully!');
return true;
} catch (error) {
console.error('❌ Story flow test failed:', error.message);
console.error(error.stack);
return false;
}
}
// Run the test
console.log('🚀 Starting end-to-end tests...\n');
console.log('================================\n');
testStoryFlow().then(success => {
if (success) {
console.log('\n================================');
console.log('✅ All tests passed!');
process.exit(0);
} else {
console.log('\n================================');
console.log('❌ Tests failed!');
process.exit(1);
}
}).catch(error => {
console.error('Fatal error:', error);
process.exit(1);
});