refactor: handle larger files in importer (#2692)

This commit is contained in:
Aman Harwara
2023-12-11 16:30:31 +05:30
committed by GitHub
parent 63e69b5e4b
commit 82d5a36932
22 changed files with 614 additions and 513 deletions

View File

@@ -1,11 +1,11 @@
import { DecryptedTransferPayload, NoteContent } from '@standardnotes/models'
import { SNNote } from '@standardnotes/models'
import { SimplenoteConverter } from './SimplenoteConverter'
import data from './testData'
import { ContentType } from '@standardnotes/domain-core'
import { CreateNoteFn } from '../Converter'
import { InsertNoteFn } from '../Converter'
describe('SimplenoteConverter', () => {
const createNote: CreateNoteFn = ({ title, text, trashed, createdAt, updatedAt }) =>
const createNote: InsertNoteFn = async ({ title, text, trashed, createdAt, updatedAt }) =>
({
uuid: Math.random().toString(),
created_at: createdAt,
@@ -17,12 +17,12 @@ describe('SimplenoteConverter', () => {
trashed,
references: [],
},
}) as unknown as DecryptedTransferPayload<NoteContent>
}) as unknown as SNNote
it('should parse', () => {
it('should parse', async () => {
const converter = new SimplenoteConverter()
const result = converter.parse(data, createNote)
const result = await converter.parse(data, createNote)
expect(result).not.toBeNull()
expect(result?.length).toBe(3)