Skip to content

Commit

Permalink
tests(GDrive): Fail if adapter left behind more than 1 file
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Sep 10, 2024
1 parent 837d73f commit dd552e1
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,13 @@ describe('Floccus', function() {
}
if (ACCOUNT_DATA.type === 'google-drive') {
const fileList = await account.server.listFiles('name = ' + "'" + account.server.bookmark_file + "'")
const file = fileList.files[0]
if (file) {
const files = fileList.files
for (const file of files) {
await account.server.deleteFile(file.id)
}
if (files.length > 1) {
throw new Error('Google Drive sync left more than one file behind')
}
}
await account.delete()
})
Expand Down Expand Up @@ -3279,10 +3282,13 @@ describe('Floccus', function() {
}
if (ACCOUNT_DATA.type === 'google-drive') {
const fileList = await account1.server.listFiles('name = ' + "'" + account1.server.bookmark_file + "'")
const file = fileList.files[0]
if (file) {
const files = fileList.files
for (const file of files) {
await account1.server.deleteFile(file.id)
}
if (files.length > 1) {
throw new Error('Google Drive sync left more than one file behind')
}
}
try {
await browser.bookmarks.removeTree(account1.getData().localRoot)
Expand Down Expand Up @@ -4704,10 +4710,13 @@ describe('Floccus', function() {
}
if (ACCOUNT_DATA.type === 'google-drive') {
const fileList = await account.server.listFiles('name = ' + "'" + account.server.bookmark_file + "'")
const file = fileList.files[0]
if (file) {
const files = fileList.files
for (const file of files) {
await account.server.deleteFile(file.id)
}
if (files.length > 1) {
throw new Error('Google Drive sync left more than one file behind')
}
}
await account.delete()
})
Expand Down Expand Up @@ -5047,10 +5056,13 @@ describe('Floccus', function() {
}
if (ACCOUNT_DATA.type === 'google-drive') {
const fileList = await account1.server.listFiles('name = ' + "'" + account1.server.bookmark_file + "'")
const file = fileList.files[0]
if (file) {
const files = fileList.files
for (const file of files) {
await account1.server.deleteFile(file.id)
}
if (files.length > 1) {
throw new Error('Google Drive sync left more than one file behind')
}
}
await account1.delete()
await browser.bookmarks.removeTree(account2.getData().localRoot)
Expand Down

0 comments on commit dd552e1

Please sign in to comment.