markupr 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/review-feedback.md +47 -0
- package/.eslintrc.json +35 -0
- package/.github/CODEOWNERS +16 -0
- package/.github/FUNDING.yml +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +56 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +54 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +89 -0
- package/.github/dependabot.yml +70 -0
- package/.github/workflows/ci.yml +184 -0
- package/.github/workflows/deploy-landing.yml +134 -0
- package/.github/workflows/nightly.yml +288 -0
- package/.github/workflows/release.yml +318 -0
- package/CHANGELOG.md +127 -0
- package/CLAUDE.md +137 -0
- package/CODE_OF_CONDUCT.md +9 -0
- package/CONTRIBUTING.md +390 -0
- package/LICENSE +21 -0
- package/PRODUCT_VISION.md +277 -0
- package/README.md +517 -0
- package/SECURITY.md +51 -0
- package/SIGNING_INSTRUCTIONS.md +284 -0
- package/assets/DMG_BACKGROUND_INSTRUCTIONS.md +130 -0
- package/assets/svg-source/dmg-background.svg +70 -0
- package/assets/svg-source/icon.svg +20 -0
- package/assets/svg-source/tray-icon-processing.svg +7 -0
- package/assets/svg-source/tray-icon-recording.svg +7 -0
- package/assets/svg-source/tray-icon.svg +6 -0
- package/assets/tray-complete.png +0 -0
- package/assets/tray-complete@2x.png +0 -0
- package/assets/tray-completeTemplate.png +0 -0
- package/assets/tray-completeTemplate@2x.png +0 -0
- package/assets/tray-error.png +0 -0
- package/assets/tray-error@2x.png +0 -0
- package/assets/tray-errorTemplate.png +0 -0
- package/assets/tray-errorTemplate@2x.png +0 -0
- package/assets/tray-icon-processing.png +0 -0
- package/assets/tray-icon-processing@2x.png +0 -0
- package/assets/tray-icon-processingTemplate.png +0 -0
- package/assets/tray-icon-processingTemplate@2x.png +0 -0
- package/assets/tray-icon-recording.png +0 -0
- package/assets/tray-icon-recording@2x.png +0 -0
- package/assets/tray-icon-recordingTemplate.png +0 -0
- package/assets/tray-icon-recordingTemplate@2x.png +0 -0
- package/assets/tray-icon.png +0 -0
- package/assets/tray-icon@2x.png +0 -0
- package/assets/tray-iconTemplate.png +0 -0
- package/assets/tray-iconTemplate@2x.png +0 -0
- package/assets/tray-idle.png +0 -0
- package/assets/tray-idle@2x.png +0 -0
- package/assets/tray-idleTemplate.png +0 -0
- package/assets/tray-idleTemplate@2x.png +0 -0
- package/assets/tray-processing-0.png +0 -0
- package/assets/tray-processing-0@2x.png +0 -0
- package/assets/tray-processing-0Template.png +0 -0
- package/assets/tray-processing-0Template@2x.png +0 -0
- package/assets/tray-processing-1.png +0 -0
- package/assets/tray-processing-1@2x.png +0 -0
- package/assets/tray-processing-1Template.png +0 -0
- package/assets/tray-processing-1Template@2x.png +0 -0
- package/assets/tray-processing-2.png +0 -0
- package/assets/tray-processing-2@2x.png +0 -0
- package/assets/tray-processing-2Template.png +0 -0
- package/assets/tray-processing-2Template@2x.png +0 -0
- package/assets/tray-processing-3.png +0 -0
- package/assets/tray-processing-3@2x.png +0 -0
- package/assets/tray-processing-3Template.png +0 -0
- package/assets/tray-processing-3Template@2x.png +0 -0
- package/assets/tray-processing.png +0 -0
- package/assets/tray-processing@2x.png +0 -0
- package/assets/tray-processingTemplate.png +0 -0
- package/assets/tray-processingTemplate@2x.png +0 -0
- package/assets/tray-recording.png +0 -0
- package/assets/tray-recording@2x.png +0 -0
- package/assets/tray-recordingTemplate.png +0 -0
- package/assets/tray-recordingTemplate@2x.png +0 -0
- package/build/DMG_BACKGROUND_SPEC.md +50 -0
- package/build/dmg-background.png +0 -0
- package/build/dmg-background@2x.png +0 -0
- package/build/entitlements.mac.inherit.plist +27 -0
- package/build/entitlements.mac.plist +41 -0
- package/build/favicon-16.png +0 -0
- package/build/favicon-180.png +0 -0
- package/build/favicon-192.png +0 -0
- package/build/favicon-32.png +0 -0
- package/build/favicon-48.png +0 -0
- package/build/favicon-512.png +0 -0
- package/build/favicon-64.png +0 -0
- package/build/icon-128.png +0 -0
- package/build/icon-16.png +0 -0
- package/build/icon-24.png +0 -0
- package/build/icon-256.png +0 -0
- package/build/icon-32.png +0 -0
- package/build/icon-48.png +0 -0
- package/build/icon-64.png +0 -0
- package/build/icon.icns +0 -0
- package/build/icon.ico +0 -0
- package/build/icon.iconset/icon_128x128.png +0 -0
- package/build/icon.iconset/icon_128x128@2x.png +0 -0
- package/build/icon.iconset/icon_16x16.png +0 -0
- package/build/icon.iconset/icon_16x16@2x.png +0 -0
- package/build/icon.iconset/icon_256x256.png +0 -0
- package/build/icon.iconset/icon_256x256@2x.png +0 -0
- package/build/icon.iconset/icon_32x32.png +0 -0
- package/build/icon.iconset/icon_32x32@2x.png +0 -0
- package/build/icon.iconset/icon_512x512.png +0 -0
- package/build/icon.iconset/icon_512x512@2x.png +0 -0
- package/build/icon.png +0 -0
- package/build/installer-header.bmp +0 -0
- package/build/installer-header.png +0 -0
- package/build/installer-sidebar.bmp +0 -0
- package/build/installer-sidebar.png +0 -0
- package/build/installer.nsh +45 -0
- package/build/overlay-processing.png +0 -0
- package/build/overlay-recording.png +0 -0
- package/build/toolbar-record.png +0 -0
- package/build/toolbar-screenshot.png +0 -0
- package/build/toolbar-settings.png +0 -0
- package/build/toolbar-stop.png +0 -0
- package/dist/main/index.mjs +12612 -0
- package/dist/preload/index.mjs +907 -0
- package/dist/renderer/assets/index-CCmUjl9K.js +19495 -0
- package/dist/renderer/assets/index-CUqz_Gs6.css +2270 -0
- package/dist/renderer/index.html +27 -0
- package/docs/AI_AGENT_QUICKSTART.md +42 -0
- package/docs/AI_PIPELINE_DESIGN.md +595 -0
- package/docs/API.md +514 -0
- package/docs/ARCHITECTURE.md +460 -0
- package/docs/CONFIGURATION.md +336 -0
- package/docs/DEVELOPMENT.md +508 -0
- package/docs/EXPORT_FORMATS.md +451 -0
- package/docs/GETTING_STARTED.md +236 -0
- package/docs/KEYBOARD_SHORTCUTS.md +334 -0
- package/docs/TROUBLESHOOTING.md +418 -0
- package/docs/landing/index.html +672 -0
- package/docs/landing/script.js +342 -0
- package/docs/landing/styles.css +1543 -0
- package/electron-builder.yml +140 -0
- package/electron.vite.config.ts +63 -0
- package/package.json +108 -0
- package/railway.json +12 -0
- package/scripts/build.mjs +51 -0
- package/scripts/generate-icons.mjs +314 -0
- package/scripts/generate-installer-images.cjs +253 -0
- package/scripts/generate-tray-icons.mjs +258 -0
- package/scripts/notarize.cjs +180 -0
- package/scripts/one-click-clean-test.sh +147 -0
- package/scripts/postinstall.mjs +36 -0
- package/scripts/setup-markupr.sh +55 -0
- package/setup +17 -0
- package/site/index.html +1835 -0
- package/site/package.json +11 -0
- package/site/railway.json +12 -0
- package/site/server.js +31 -0
- package/src/main/AutoUpdater.ts +392 -0
- package/src/main/CrashRecovery.ts +655 -0
- package/src/main/ErrorHandler.ts +703 -0
- package/src/main/HotkeyManager.ts +399 -0
- package/src/main/MenuManager.ts +529 -0
- package/src/main/PermissionManager.ts +420 -0
- package/src/main/SessionController.ts +1465 -0
- package/src/main/TrayManager.ts +540 -0
- package/src/main/ai/AIPipelineManager.ts +199 -0
- package/src/main/ai/ClaudeAnalyzer.ts +339 -0
- package/src/main/ai/ImageOptimizer.ts +176 -0
- package/src/main/ai/StructuredMarkdownBuilder.ts +379 -0
- package/src/main/ai/index.ts +16 -0
- package/src/main/ai/types.ts +258 -0
- package/src/main/analysis/ClarificationGenerator.ts +385 -0
- package/src/main/analysis/FeedbackAnalyzer.ts +531 -0
- package/src/main/analysis/index.ts +19 -0
- package/src/main/audio/AudioCapture.ts +978 -0
- package/src/main/audio/audioUtils.ts +100 -0
- package/src/main/audio/index.ts +20 -0
- package/src/main/capture/index.ts +1 -0
- package/src/main/index.ts +1693 -0
- package/src/main/ipc/captureHandlers.ts +272 -0
- package/src/main/ipc/index.ts +45 -0
- package/src/main/ipc/outputHandlers.ts +302 -0
- package/src/main/ipc/sessionHandlers.ts +56 -0
- package/src/main/ipc/settingsHandlers.ts +471 -0
- package/src/main/ipc/types.ts +56 -0
- package/src/main/ipc/windowHandlers.ts +277 -0
- package/src/main/output/ClipboardService.ts +369 -0
- package/src/main/output/ExportService.ts +539 -0
- package/src/main/output/FileManager.ts +416 -0
- package/src/main/output/MarkdownGenerator.ts +791 -0
- package/src/main/output/MarkdownPatcher.ts +299 -0
- package/src/main/output/index.ts +186 -0
- package/src/main/output/sessionAdapter.ts +207 -0
- package/src/main/output/templates/html-template.ts +553 -0
- package/src/main/pipeline/FrameExtractor.ts +330 -0
- package/src/main/pipeline/PostProcessor.ts +399 -0
- package/src/main/pipeline/TranscriptAnalyzer.ts +226 -0
- package/src/main/pipeline/index.ts +36 -0
- package/src/main/platform/WindowsTaskbar.ts +600 -0
- package/src/main/platform/index.ts +16 -0
- package/src/main/settings/SettingsManager.ts +730 -0
- package/src/main/settings/index.ts +19 -0
- package/src/main/transcription/ModelDownloadManager.ts +494 -0
- package/src/main/transcription/TierManager.ts +219 -0
- package/src/main/transcription/TranscriptionRecoveryService.ts +340 -0
- package/src/main/transcription/WhisperService.ts +748 -0
- package/src/main/transcription/index.ts +56 -0
- package/src/main/transcription/types.ts +135 -0
- package/src/main/windows/PopoverManager.ts +284 -0
- package/src/main/windows/TaskbarIntegration.ts +452 -0
- package/src/main/windows/index.ts +23 -0
- package/src/preload/index.ts +1047 -0
- package/src/renderer/App.tsx +515 -0
- package/src/renderer/AppWrapper.tsx +28 -0
- package/src/renderer/assets/logo-dark.svg +7 -0
- package/src/renderer/assets/logo.svg +7 -0
- package/src/renderer/audio/AudioCaptureRenderer.ts +454 -0
- package/src/renderer/capture/ScreenRecordingRenderer.ts +492 -0
- package/src/renderer/components/AnnotationOverlay.tsx +836 -0
- package/src/renderer/components/AudioWaveform.tsx +811 -0
- package/src/renderer/components/ClarificationQuestions.tsx +656 -0
- package/src/renderer/components/CountdownTimer.tsx +495 -0
- package/src/renderer/components/CrashRecoveryDialog.tsx +632 -0
- package/src/renderer/components/DonateButton.tsx +127 -0
- package/src/renderer/components/ErrorBoundary.tsx +308 -0
- package/src/renderer/components/ExportDialog.tsx +872 -0
- package/src/renderer/components/HotkeyHint.tsx +261 -0
- package/src/renderer/components/KeyboardShortcuts.tsx +787 -0
- package/src/renderer/components/ModelDownloadDialog.tsx +844 -0
- package/src/renderer/components/Onboarding.tsx +1830 -0
- package/src/renderer/components/ProcessingOverlay.tsx +157 -0
- package/src/renderer/components/RecordingOverlay.tsx +423 -0
- package/src/renderer/components/SessionHistory.tsx +1746 -0
- package/src/renderer/components/SessionReview.tsx +1321 -0
- package/src/renderer/components/SettingsPanel.tsx +217 -0
- package/src/renderer/components/Skeleton.tsx +347 -0
- package/src/renderer/components/StatusIndicator.tsx +86 -0
- package/src/renderer/components/ThemeProvider.tsx +429 -0
- package/src/renderer/components/Tooltip.tsx +370 -0
- package/src/renderer/components/TranscriptionPreview.tsx +183 -0
- package/src/renderer/components/TranscriptionTierSelector.tsx +640 -0
- package/src/renderer/components/UpdateNotification.tsx +377 -0
- package/src/renderer/components/WindowSelector.tsx +947 -0
- package/src/renderer/components/index.ts +99 -0
- package/src/renderer/components/primitives/ApiKeyInput.tsx +98 -0
- package/src/renderer/components/primitives/ColorPicker.tsx +65 -0
- package/src/renderer/components/primitives/DangerButton.tsx +45 -0
- package/src/renderer/components/primitives/DirectoryPicker.tsx +41 -0
- package/src/renderer/components/primitives/Dropdown.tsx +34 -0
- package/src/renderer/components/primitives/KeyRecorder.tsx +117 -0
- package/src/renderer/components/primitives/SettingsSection.tsx +32 -0
- package/src/renderer/components/primitives/Slider.tsx +43 -0
- package/src/renderer/components/primitives/Toggle.tsx +36 -0
- package/src/renderer/components/primitives/index.ts +10 -0
- package/src/renderer/components/settings/AdvancedTab.tsx +174 -0
- package/src/renderer/components/settings/AppearanceTab.tsx +77 -0
- package/src/renderer/components/settings/GeneralTab.tsx +40 -0
- package/src/renderer/components/settings/HotkeysTab.tsx +79 -0
- package/src/renderer/components/settings/RecordingTab.tsx +84 -0
- package/src/renderer/components/settings/index.ts +9 -0
- package/src/renderer/components/settings/settingsStyles.ts +673 -0
- package/src/renderer/components/settings/tabConfig.tsx +85 -0
- package/src/renderer/components/settings/useSettingsPanel.ts +447 -0
- package/src/renderer/contexts/ProcessingContext.tsx +227 -0
- package/src/renderer/contexts/RecordingContext.tsx +683 -0
- package/src/renderer/contexts/UIContext.tsx +326 -0
- package/src/renderer/contexts/index.ts +24 -0
- package/src/renderer/donateMessages.ts +69 -0
- package/src/renderer/hooks/index.ts +75 -0
- package/src/renderer/hooks/useAnimation.tsx +544 -0
- package/src/renderer/hooks/useTheme.ts +313 -0
- package/src/renderer/index.html +26 -0
- package/src/renderer/main.tsx +52 -0
- package/src/renderer/styles/animations.css +1093 -0
- package/src/renderer/styles/app-shell.css +662 -0
- package/src/renderer/styles/globals.css +515 -0
- package/src/renderer/styles/theme.ts +578 -0
- package/src/renderer/types/electron.d.ts +385 -0
- package/src/shared/hotkeys.ts +283 -0
- package/src/shared/types.ts +809 -0
- package/tests/clipboard.test.ts +228 -0
- package/tests/e2e/criticalPaths.test.ts +594 -0
- package/tests/feedbackAnalyzer.test.ts +303 -0
- package/tests/integration/sessionFlow.test.ts +583 -0
- package/tests/markdownGenerator.test.ts +418 -0
- package/tests/output.test.ts +96 -0
- package/tests/setup.ts +486 -0
- package/tests/unit/appIntegration.test.ts +676 -0
- package/tests/unit/appViewState.test.ts +281 -0
- package/tests/unit/audioIpcChannels.test.ts +17 -0
- package/tests/unit/exportService.test.ts +492 -0
- package/tests/unit/hotkeys.test.ts +92 -0
- package/tests/unit/navigationPreload.test.ts +94 -0
- package/tests/unit/onboardingFlow.test.ts +345 -0
- package/tests/unit/permissionManager.test.ts +175 -0
- package/tests/unit/permissionManagerExpanded.test.ts +296 -0
- package/tests/unit/screenRecordingRenderer.test.ts +368 -0
- package/tests/unit/sessionController.test.ts +515 -0
- package/tests/unit/tierManager.test.ts +61 -0
- package/tests/unit/tierManagerExpanded.test.ts +142 -0
- package/tests/unit/transcriptAnalyzer.test.ts +64 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +46 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for FeedbackAnalyzer
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect } from 'vitest';
|
|
5
|
+
import { feedbackAnalyzer, type AnalysisResult } from '../src/main/analysis/FeedbackAnalyzer';
|
|
6
|
+
|
|
7
|
+
describe('FeedbackAnalyzer', () => {
|
|
8
|
+
describe('Category Detection', () => {
|
|
9
|
+
it('should detect bug reports', () => {
|
|
10
|
+
const testCases = [
|
|
11
|
+
"The save button is broken, it doesn't work at all",
|
|
12
|
+
'I found a bug in the export feature',
|
|
13
|
+
'The app crashes when I click submit',
|
|
14
|
+
"This feature doesn't work correctly",
|
|
15
|
+
'Error when trying to upload a file',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
for (const text of testCases) {
|
|
19
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
20
|
+
expect(result.category).toBe('bug');
|
|
21
|
+
expect(result.categoryConfidence).toBeGreaterThan(0.25);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should detect UX issues', () => {
|
|
26
|
+
const testCases = [
|
|
27
|
+
'This menu is really confusing to navigate',
|
|
28
|
+
"I can't find where the settings are",
|
|
29
|
+
'The interface is not intuitive at all',
|
|
30
|
+
'This is hard to use on mobile',
|
|
31
|
+
"It's unclear what this button does",
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
for (const text of testCases) {
|
|
35
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
36
|
+
expect(result.category).toBe('ux-issue');
|
|
37
|
+
expect(result.categoryConfidence).toBeGreaterThan(0.25);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should detect suggestions', () => {
|
|
42
|
+
const testCases = [
|
|
43
|
+
'It would be nice to have dark mode',
|
|
44
|
+
'You should add a search feature',
|
|
45
|
+
'I suggest adding keyboard shortcuts',
|
|
46
|
+
'Could you add the ability to export to PDF?',
|
|
47
|
+
'What if there was a way to undo changes?',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
for (const text of testCases) {
|
|
51
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
52
|
+
expect(result.category).toBe('suggestion');
|
|
53
|
+
expect(result.categoryConfidence).toBeGreaterThan(0.25);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should detect performance issues', () => {
|
|
58
|
+
const testCases = [
|
|
59
|
+
'The app is really slow when loading data',
|
|
60
|
+
'There is noticeable lag when scrolling',
|
|
61
|
+
'Page takes forever to load',
|
|
62
|
+
'The performance is terrible on large files',
|
|
63
|
+
'Everything freezes when I filter the results',
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
for (const text of testCases) {
|
|
67
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
68
|
+
expect(result.category).toBe('performance');
|
|
69
|
+
expect(result.categoryConfidence).toBeGreaterThan(0.25);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should detect questions', () => {
|
|
74
|
+
const testCases = [
|
|
75
|
+
'How do I export my data?',
|
|
76
|
+
'Why does this happen when I click here?',
|
|
77
|
+
'Is there a way to customize the colors?',
|
|
78
|
+
"I'm wondering if there's a keyboard shortcut for this",
|
|
79
|
+
"What's the difference between save and publish?",
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
for (const text of testCases) {
|
|
83
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
84
|
+
expect(result.category).toBe('question');
|
|
85
|
+
expect(result.categoryConfidence).toBeGreaterThan(0.25);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should default to general for ambiguous feedback', () => {
|
|
90
|
+
const testCases = [
|
|
91
|
+
'I like this app',
|
|
92
|
+
'Good job on the design',
|
|
93
|
+
'Thanks for the update',
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
for (const text of testCases) {
|
|
97
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
98
|
+
expect(result.category).toBe('general');
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('Severity Detection', () => {
|
|
104
|
+
it('should detect critical severity', () => {
|
|
105
|
+
const testCases = [
|
|
106
|
+
'The app crashed and I lost all my data',
|
|
107
|
+
'Critical security vulnerability found',
|
|
108
|
+
"I can't use the app at all, it's completely broken",
|
|
109
|
+
'Urgent: need this fixed immediately',
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
for (const text of testCases) {
|
|
113
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
114
|
+
expect(result.severity).toBe('critical');
|
|
115
|
+
expect(result.severityConfidence).toBeGreaterThan(0.3);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should detect high severity', () => {
|
|
120
|
+
const testCases = [
|
|
121
|
+
"The export feature is broken, I can't do my work",
|
|
122
|
+
"This is a major issue that's blocking me",
|
|
123
|
+
"The form doesn't work and I can't submit",
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
for (const text of testCases) {
|
|
127
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
128
|
+
expect(['critical', 'high']).toContain(result.severity);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should detect medium severity', () => {
|
|
133
|
+
const testCases = [
|
|
134
|
+
'This could be better, the layout needs improvement',
|
|
135
|
+
"It's annoying that I have to click twice",
|
|
136
|
+
'The feature is confusing and needs work',
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
for (const text of testCases) {
|
|
140
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
141
|
+
expect(['high', 'medium']).toContain(result.severity);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('should detect low severity', () => {
|
|
146
|
+
const testCases = [
|
|
147
|
+
'Minor nitpick: the spacing looks a bit off',
|
|
148
|
+
'This is a small polish thing, not urgent',
|
|
149
|
+
'Nice to have: when you get a chance, add tooltips',
|
|
150
|
+
"It's trivial but the icon could be bigger",
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
for (const text of testCases) {
|
|
154
|
+
const result = feedbackAnalyzer.analyze(text);
|
|
155
|
+
expect(result.severity).toBe('low');
|
|
156
|
+
expect(result.severityConfidence).toBeGreaterThan(0.25);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
describe('Keyword Extraction', () => {
|
|
162
|
+
it('should extract UI component keywords', () => {
|
|
163
|
+
const result = feedbackAnalyzer.analyze(
|
|
164
|
+
'The button in the modal dialog is not working when I click it'
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
expect(result.keywords).toContain('button');
|
|
168
|
+
expect(result.keywords).toContain('modal');
|
|
169
|
+
expect(result.keywords).toContain('dialog');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('should extract action keywords', () => {
|
|
173
|
+
const result = feedbackAnalyzer.analyze(
|
|
174
|
+
'When I try to upload a file and then save it, the page freezes'
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
expect(result.keywords).toContain('upload');
|
|
178
|
+
expect(result.keywords).toContain('file');
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should limit keywords to 8', () => {
|
|
182
|
+
const result = feedbackAnalyzer.analyze(
|
|
183
|
+
'The button form input field modal dialog popup menu dropdown select checkbox toggle switch slider tab card list table grid header footer sidebar navigation search filter sort pagination'
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
expect(result.keywords.length).toBeLessThanOrEqual(8);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
describe('Title Generation', () => {
|
|
191
|
+
it('should generate titles with category-appropriate prefixes', () => {
|
|
192
|
+
const bugResult = feedbackAnalyzer.analyze(
|
|
193
|
+
'The save button crashes the app'
|
|
194
|
+
);
|
|
195
|
+
expect(bugResult.suggestedTitle).toMatch(/^Fix:/);
|
|
196
|
+
|
|
197
|
+
const suggestionResult = feedbackAnalyzer.analyze(
|
|
198
|
+
'It would be great to have dark mode'
|
|
199
|
+
);
|
|
200
|
+
expect(suggestionResult.suggestedTitle).toMatch(/^Add:/);
|
|
201
|
+
|
|
202
|
+
const perfResult = feedbackAnalyzer.analyze(
|
|
203
|
+
'The app is really slow when loading'
|
|
204
|
+
);
|
|
205
|
+
expect(perfResult.suggestedTitle).toMatch(/^Optimize:/);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('should truncate long titles', () => {
|
|
209
|
+
const result = feedbackAnalyzer.analyze(
|
|
210
|
+
'This is a very long feedback message that goes on and on about various issues with the application including performance problems, user interface confusion, and several bugs that I have encountered while using the software over the past few weeks'
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
expect(result.suggestedTitle.length).toBeLessThanOrEqual(70);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('should remove filler words from beginning', () => {
|
|
217
|
+
const result = feedbackAnalyzer.analyze(
|
|
218
|
+
'So basically I think that the button should be bigger'
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
expect(result.suggestedTitle.toLowerCase()).not.toMatch(/^(add:|improve:)?\s*(so|basically|i think)/);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe('Batch Analysis', () => {
|
|
226
|
+
it('should analyze multiple transcriptions', () => {
|
|
227
|
+
const transcriptions = [
|
|
228
|
+
"The app crashed when I clicked save",
|
|
229
|
+
"It would be nice to have a dark mode option",
|
|
230
|
+
"How do I export my data?",
|
|
231
|
+
];
|
|
232
|
+
|
|
233
|
+
const results = feedbackAnalyzer.analyzeBatch(transcriptions);
|
|
234
|
+
|
|
235
|
+
expect(results).toHaveLength(3);
|
|
236
|
+
expect(results[0].category).toBe('bug');
|
|
237
|
+
expect(results[1].category).toBe('suggestion');
|
|
238
|
+
expect(results[2].category).toBe('question');
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe('Confidence Scores', () => {
|
|
243
|
+
it('should have higher confidence for clear signals', () => {
|
|
244
|
+
const clearBug = feedbackAnalyzer.analyze('Bug: the app crashes when clicking the button and is completely broken');
|
|
245
|
+
const weakBug = feedbackAnalyzer.analyze('There might be an issue with this');
|
|
246
|
+
|
|
247
|
+
// Clear signals should have high confidence
|
|
248
|
+
expect(clearBug.categoryConfidence).toBeGreaterThan(0.5);
|
|
249
|
+
// Weak signals should have lower confidence
|
|
250
|
+
expect(weakBug.categoryConfidence).toBeLessThan(clearBug.categoryConfidence);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it('should have confidence between 0 and 1', () => {
|
|
254
|
+
const result = feedbackAnalyzer.analyze('This is a test feedback message');
|
|
255
|
+
|
|
256
|
+
expect(result.categoryConfidence).toBeGreaterThanOrEqual(0);
|
|
257
|
+
expect(result.categoryConfidence).toBeLessThanOrEqual(1);
|
|
258
|
+
expect(result.severityConfidence).toBeGreaterThanOrEqual(0);
|
|
259
|
+
expect(result.severityConfidence).toBeLessThanOrEqual(1);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
describe('Processing Time', () => {
|
|
264
|
+
it('should process quickly (under 10ms)', () => {
|
|
265
|
+
const result = feedbackAnalyzer.analyze(
|
|
266
|
+
'The save button crashes the app when I click it multiple times'
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
expect(result.processingTimeMs).toBeLessThan(10);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
describe('Edge Cases', () => {
|
|
274
|
+
it('should handle empty string', () => {
|
|
275
|
+
const result = feedbackAnalyzer.analyze('');
|
|
276
|
+
|
|
277
|
+
expect(result.category).toBe('general');
|
|
278
|
+
expect(result.suggestedTitle).toBe('Untitled feedback');
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('should handle whitespace-only string', () => {
|
|
282
|
+
const result = feedbackAnalyzer.analyze(' \n\t ');
|
|
283
|
+
|
|
284
|
+
expect(result.category).toBe('general');
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it('should handle special characters', () => {
|
|
288
|
+
const result = feedbackAnalyzer.analyze(
|
|
289
|
+
"The button's behavior doesn't match what I'd expect and is broken!!!"
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
expect(result.category).toBe('bug');
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it('should handle unicode text', () => {
|
|
296
|
+
const result = feedbackAnalyzer.analyze(
|
|
297
|
+
'The button is broken'
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
expect(result.category).toBe('bug');
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
});
|