Skip to content

Commit 88f4344

Browse files
committed
Lint fix
1 parent 959f24e commit 88f4344

File tree

2 files changed

+40
-35
lines changed

2 files changed

+40
-35
lines changed

injected/integration-test/duck-ai-data-clearing.spec.js

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ test('duck-ai-data-clearing feature clears localStorage and IndexedDB', async ({
1212
messageCallback: 'messageCallback',
1313
});
1414
await collector.load(HTML, CONFIG);
15-
15+
1616
const duckAiDataClearing = new DuckAiDataClearingSpec(page);
17-
17+
1818
// Setup test data
1919
await duckAiDataClearing.setupTestData();
2020
await duckAiDataClearing.waitForDataSetup();
21-
21+
2222
// Trigger data clearing via messaging
2323
await collector.simulateSubscriptionMessage('duckAiDataClearing', 'duckAiClearData', {});
24-
24+
2525
// Wait for completion message
2626
const messages = await collector.waitForMessage('duckAiClearDataCompleted', 1);
2727
expect(messages).toHaveLength(1);
2828
expect(messages[0].payload.method).toBe('duckAiClearDataCompleted');
29-
29+
3030
// Verify data is actually cleared
3131
await duckAiDataClearing.verifyDataCleared();
3232
await duckAiDataClearing.waitForVerification('Verification complete: All data cleared');
@@ -40,12 +40,12 @@ test('duck-ai-data-clearing feature handles IndexedDB errors gracefully', async
4040
messageCallback: 'messageCallback',
4141
});
4242
await collector.load(HTML, CONFIG);
43-
43+
4444
const duckAiDataClearing = new DuckAiDataClearingSpec(page);
45-
45+
4646
// Setup localStorage data only (no IndexedDB)
4747
await duckAiDataClearing.setupLocalStorageOnly();
48-
48+
4949
// Mock IndexedDB to fail
5050
await page.evaluate(() => {
5151
const originalOpen = window.indexedDB.open;
@@ -60,10 +60,10 @@ test('duck-ai-data-clearing feature handles IndexedDB errors gracefully', async
6060
return request;
6161
};
6262
});
63-
63+
6464
// Trigger data clearing
6565
await collector.simulateSubscriptionMessage('duckAiDataClearing', 'duckAiClearData', {});
66-
66+
6767
// Should still get completion message (localStorage should clear successfully)
6868
const messages = await collector.waitForMessage('duckAiClearDataFailed', 1);
6969
expect(messages).toHaveLength(1);
@@ -78,17 +78,17 @@ test('duck-ai-data-clearing feature handles localStorage errors gracefully', asy
7878
messageCallback: 'messageCallback',
7979
});
8080
await collector.load(HTML, CONFIG);
81-
81+
8282
// Mock localStorage to throw an error
8383
await page.evaluate(() => {
8484
Storage.prototype.removeItem = () => {
8585
throw new Error('Simulated localStorage error');
8686
};
8787
});
88-
88+
8989
// Trigger data clearing
9090
await collector.simulateSubscriptionMessage('duckAiDataClearing', 'duckAiClearData', {});
91-
91+
9292
// Should get failure message
9393
const messages = await collector.waitForMessage('duckAiClearDataFailed', 1);
9494
expect(messages).toHaveLength(1);
@@ -103,14 +103,14 @@ test('duck-ai-data-clearing feature succeeds when data collections do not exist
103103
messageCallback: 'messageCallback',
104104
});
105105
await collector.load(HTML, CONFIG);
106-
106+
107107
const duckAiDataClearing = new DuckAiDataClearingSpec(page);
108-
108+
109109
// Ensure localStorage item doesn't exist
110110
await page.evaluate(() => {
111111
localStorage.removeItem('savedAIChats');
112112
});
113-
113+
114114
// Ensure IndexedDB is clean (no existing database or object store)
115115
await page.evaluate(() => {
116116
return new Promise((resolve) => {
@@ -120,15 +120,15 @@ test('duck-ai-data-clearing feature succeeds when data collections do not exist
120120
deleteRequest.onblocked = () => resolve(null); // Continue even if blocked
121121
});
122122
});
123-
123+
124124
// Trigger data clearing on non-existent/empty data
125125
await collector.simulateSubscriptionMessage('duckAiDataClearing', 'duckAiClearData', {});
126-
126+
127127
// Should still get completion message since there's nothing to fail
128128
const messages = await collector.waitForMessage('duckAiClearDataCompleted', 1);
129129
expect(messages).toHaveLength(1);
130130
expect(messages[0].payload.method).toBe('duckAiClearDataCompleted');
131-
131+
132132
// Verify that subsequent verification shows no data exists
133133
await duckAiDataClearing.verifyDataCleared();
134134
await duckAiDataClearing.waitForVerification('Verification complete: All data cleared');
@@ -148,28 +148,33 @@ class DuckAiDataClearingSpec {
148148

149149
async setupLocalStorageOnly() {
150150
await this.page.evaluate(() => {
151-
localStorage.setItem('savedAIChats', JSON.stringify([
152-
{ id: 1, message: 'test chat 1' }
153-
]));
151+
localStorage.setItem('savedAIChats', JSON.stringify([{ id: 1, message: 'test chat 1' }]));
154152
});
155153
}
156154

157155
async waitForDataSetup() {
158-
await this.page.waitForFunction(() => {
159-
const status = document.getElementById('data-status');
160-
return status && status.textContent === 'Test data setup complete';
161-
}, { timeout: 5000 });
156+
await this.page.waitForFunction(
157+
() => {
158+
const status = document.getElementById('data-status');
159+
return status && status.textContent === 'Test data setup complete';
160+
},
161+
{ timeout: 5000 },
162+
);
162163
}
163164

164165
async verifyDataCleared() {
165166
await this.page.click('#verify-data');
166167
}
167168

168169
async waitForVerification(expectedText) {
169-
await this.page.waitForFunction((expected) => {
170-
const status = document.getElementById('verify-status');
171-
return status && status.textContent === expected;
172-
}, expectedText, { timeout: 5000 });
170+
await this.page.waitForFunction(
171+
(expected) => {
172+
const status = document.getElementById('verify-status');
173+
return status && status.textContent === expected;
174+
},
175+
expectedText,
176+
{ timeout: 5000 },
177+
);
173178
}
174179
}
175180

injected/src/features/duck-ai-data-clearing.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ContentFeature from '../content-feature.js';
88
*/
99
export class DuckAiDataClearing extends ContentFeature {
1010
init() {
11-
this.messaging.subscribe('duckAiClearData', _ => this.clearData());
11+
this.messaging.subscribe('duckAiClearData', (_) => this.clearData());
1212
}
1313

1414
async clearData() {
@@ -50,22 +50,22 @@ export class DuckAiDataClearing extends ContentFeature {
5050
this.log.error('Error opening IndexedDB:', event);
5151
reject(event);
5252
};
53-
request.onsuccess = _ => {
53+
request.onsuccess = (_) => {
5454
const db = request.result;
5555
if (!db) {
5656
this.log.error('IndexedDB onsuccess but no db result');
5757
reject(new Error('No DB result'));
5858
return;
5959
}
60-
60+
6161
// Check if the object store exists
6262
if (!db.objectStoreNames.contains('chat-images')) {
6363
this.log.info('chat-images object store does not exist, nothing to clear');
6464
db.close();
6565
resolve(null);
6666
return;
6767
}
68-
68+
6969
try {
7070
const transaction = db.transaction(['chat-images'], 'readwrite');
7171
const objectStore = transaction.objectStore('chat-images');
@@ -86,7 +86,7 @@ export class DuckAiDataClearing extends ContentFeature {
8686
}
8787
};
8888
});
89-
};
89+
}
9090
}
9191

9292
export default DuckAiDataClearing;

0 commit comments

Comments
 (0)