Open source omnivore

This commit is contained in:
Jackson Harper
2022-02-11 09:24:33 -08:00
parent b5a6008f76
commit 84f32935f5
1485 changed files with 188409 additions and 0 deletions

View File

@ -0,0 +1,3 @@
const register = require('@babel/register').default;
register({ extensions: ['.ts', '.tsx', '.js', '.jsx'] });

View File

@ -0,0 +1,25 @@
import 'mocha'
import * as chai from 'chai'
import { expect } from 'chai'
import 'chai/register-should'
import chaiString from 'chai-string'
import * as fs from 'fs'
import { importCsv } from '../../src/csv'
chai.use(chaiString)
describe('Load a simple CSV file', () => {
it('should call the handler for each URL', async () => {
const urls: URL[] = []
const stream = fs.createReadStream('./test/csv/data/simple.csv')
const count = await importCsv(stream, (url): Promise<void> => {
urls.push(url)
return Promise.resolve()
})
expect(count).to.equal(2)
expect(urls).to.eql([
new URL('https://omnivore.app'),
new URL('https://google.com'),
])
})
})

View File

@ -0,0 +1,2 @@
"https://omnivore.app"
"https://google.com"
1 https://omnivore.app
2 https://google.com