1
0
forked from icd/rentgen
rentgen/background.ts
Jacek Wielemborek 8f47b56a20 refactor: move tests to tests/ directory and simplify verification
- Move test_verify.py and test-content-script.js to tests/
- Remove unused test_start_extension.sh
- Rename Dockerfile stages: test → code_quality, verify → integration_test
- Simplify test to single assertion: 17*2+3=37
- Add red TTY output for failures
- Fix runtime stage to properly copy built artifacts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 13:23:13 +01:00

31 lines
1.1 KiB
TypeScript

import { init } from "./memory";
// Use global browser object directly (available in extension context)
declare const browser: any;
init();
// Test verification handler for Marionette tests
// This proves the background script is executing and can communicate with content scripts
browser.runtime.onMessage.addListener((message: any, sender: any, sendResponse: any) => {
if (message.type === 'RENTGEN_TEST_VERIFICATION') {
// Perform a computation to prove the background script is running
// This is not just an echo - we're doing actual processing
const inputValue = message.inputValue || 0;
const computed = (inputValue * 2) + 3;
// Send back a response with computed value and metadata
const response = {
success: true,
computed: computed,
formula: `(${inputValue} * 2) + 3 = ${computed}`,
backgroundTimestamp: Date.now(),
receivedFrom: message.url || 'unknown',
originalInput: inputValue
};
sendResponse(response);
return true; // Keep channel open for async response
}
});