mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
Forked from christroutner/bch-js
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
An end-to-end test for testing the functionality of uploading a file to
|
||||
IPFS is working.
|
||||
*/
|
||||
|
||||
process.env.IPFS_API = `http://localhost:5001`
|
||||
// process.env.IPFS_API = `https://ipfs-api.fullstack.cash`
|
||||
|
||||
const BCHJS = require("../../../src/bch-js")
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe(`#IPFS`, () => {
|
||||
it("should upload a file to the server", async () => {
|
||||
const path = `${__dirname}/ipfs-e2e.js`
|
||||
|
||||
const fileModel = await bchjs.IPFS.createFileModel(path)
|
||||
console.log(`fileModel: ${JSON.stringify(fileModel, null, 2)}`)
|
||||
|
||||
const fileId = fileModel.file._id
|
||||
|
||||
const fileObj = await bchjs.IPFS.uploadFile(path, fileId)
|
||||
console.log(`fileObj: ${JSON.stringify(fileObj, null, 2)}`)
|
||||
}).timeout(30000)
|
||||
})
|
||||
Reference in New Issue
Block a user