feat: add advanced context actions and optional translation
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
const { openChat } = await import('../background/open-chat.js').catch(()=>({}));
|
||||
test('window failure falls back to tab, background mode stays inactive, final failure rejects', async()=>{
|
||||
assert.equal(typeof openChat,'function');
|
||||
const opened=[];
|
||||
const browser={windows:{create:async()=>{throw Error('window failed');}},tabs:{create:async v=>opened.push(v)}};
|
||||
await openChat(browser,'https://chatgpt.com/','new-window');
|
||||
assert.deepEqual(opened,[{url:'https://chatgpt.com/',active:true}]);
|
||||
await openChat(browser,'https://chatgpt.com/','background-tab');
|
||||
assert.equal(opened[1].active,false);
|
||||
browser.tabs.create=async()=>{throw Error('tab failed');};
|
||||
await assert.rejects(openChat(browser,'https://chatgpt.com/','new-window'));
|
||||
});
|
||||
Reference in New Issue
Block a user