Skip to content

Commit

Permalink
Add test browser to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hieu-w committed Jan 23, 2025
1 parent 15e3c82 commit 9eb3971
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:


# run the node test in an own task, so we can use a node-version matrix.
test-node:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
Expand Down Expand Up @@ -120,6 +120,12 @@ jobs:
- name: test node
run: npm run test:node

- name: Install playwright webkit
run: npx playwright install-deps webkit

- name: test browser
run: npx playwright install && npm run test:browser


# TODO this does not work atm. fix this.
# - name: test electron
Expand Down
24 changes: 14 additions & 10 deletions src/methods/indexed-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,21 @@ export function getMessagesHigherThan(db, lastCursorId) {
}

export function removeMessagesById(db, ids) {
const tx = db.transaction([OBJECT_STORE_ID], "readwrite", TRANSACTION_SETTINGS);
const objectStore = tx.objectStore(OBJECT_STORE_ID);
try {
const tx = db.transaction([OBJECT_STORE_ID], "readwrite", TRANSACTION_SETTINGS);
const objectStore = tx.objectStore(OBJECT_STORE_ID);

return Promise.all(
ids.map((id) => {
const deleteRequest = objectStore.delete(id);
return new Promise((resolve) => {
deleteRequest.onsuccess = () => resolve();
});
})
);
return Promise.all(
ids.map((id) => {
const deleteRequest = objectStore.delete(id);
return new Promise((resolve) => {
deleteRequest.onsuccess = () => resolve();
});
})
);
} catch (e) {
console.error(e);
}
}

export function getOldMessages(db, ttl) {
Expand Down

0 comments on commit 9eb3971

Please sign in to comment.