Skip to content

Commit

Permalink
test: add uploadFiles test
Browse files Browse the repository at this point in the history
  • Loading branch information
Cafe137 committed Nov 6, 2024
1 parent 03e912c commit 3b6aba4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/integration/bee-class.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,5 +681,20 @@ describe('Bee class', () => {
const fetchedData = await bee.getJsonFeed(TOPIC, { address: testIdentity.address })
expect(fetchedData).toEqual(data)
})

it('should upload files', async function () {
const files: File[] = [
{
arrayBuffer: async () => new Uint8Array([1, 2, 3]),
name: 'hello.txt',
type: 'text/plain',
lastModified: Date.now(),
size: 3,
},
] as unknown as File[]
const uploadResult = await bee.uploadFiles(getPostageBatch(), files)
const data = await bee.downloadFile(uploadResult.reference, files[0].name)
expect(data.data.hex()).toBe('010203')
})
})
})

0 comments on commit 3b6aba4

Please sign in to comment.