Set labels = undefined if pocket tags is undefined

This commit is contained in:
Hongbo Wu
2023-05-16 11:04:22 +08:00
parent 2423bff11c
commit e14080a05f
4 changed files with 9 additions and 7 deletions

View File

@ -14,7 +14,7 @@ export const importCsv = async (ctx: ImportContext, stream: Stream) => {
try {
const url = new URL(row[0])
const state = row.length > 1 ? row[1] : undefined
// labels follows format: "[label1,label2]" or "[]"
// labels follows format: "[label1,label2]"
const labels =
row.length > 2
? (row[2] as string)

View File

@ -83,7 +83,7 @@ describe('Load a complex CSV file', () => {
{
url: new URL('https://test.com'),
state: 'SUCCEEDED',
labels: [],
labels: ['test', 'development'],
},
])
})

View File

@ -1,3 +1,3 @@
"https://omnivore.app",ARCHIVED,"[test]"
"https://google.com",SUCCEEDED,"[test,development]"
https://test.com,SUCCEEDED,"[]"
https://test.com,SUCCEEDED,"[test, development]"

1 https://omnivore.app ARCHIVED [test]
2 https://google.com SUCCEEDED [test,development]
3 https://test.com SUCCEEDED [] [test, development]