diff options
Diffstat (limited to 'tests/content-constants.js')
| -rw-r--r-- | tests/content-constants.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/content-constants.js b/tests/content-constants.js new file mode 100644 index 0000000..2f274fc --- /dev/null +++ b/tests/content-constants.js @@ -0,0 +1,28 @@ +/** + * Constants mirrored from the content script (src/content/content.js). + * Used by tests to verify the classic-script mirror stays in sync with + * src/shared/constants.js. + */ +(() => { + 'use strict'; + + const PORT_NAME = 'translation-stream'; + const MAX_SELECTION_LENGTH = 20000; + const ERROR_CODES = { + INVALID_REQUEST: 'INVALID_REQUEST', + TEXT_EMPTY: 'TEXT_EMPTY', + TEXT_TOO_LONG: 'TEXT_TOO_LONG', + OLLAMA_UNAVAILABLE: 'OLLAMA_UNAVAILABLE', + MODEL_NOT_FOUND: 'MODEL_NOT_FOUND', + INVALID_SETTINGS: 'INVALID_SETTINGS', + REQUEST_ABORTED: 'REQUEST_ABORTED', + STREAM_ERROR: 'STREAM_ERROR', + UNKNOWN_ERROR: 'UNKNOWN_ERROR' + }; + const CONTENT_TO_BG = { TRANSLATE: 'translate', CANCEL: 'cancel' }; + const BG_TO_CONTENT = { STARTED: 'started', CHUNK: 'chunk', COMPLETED: 'completed', ERROR: 'error' }; + + window.contentConstantsForSyncCheck = { PORT_NAME, MAX_SELECTION_LENGTH, ERROR_CODES, CONTENT_TO_BG, BG_TO_CONTENT }; +})(); + +export const contentConstantsForSyncCheck = window.contentConstantsForSyncCheck;
\ No newline at end of file |
