Forked from christroutner/bch-js

This commit is contained in:
Chris Troutner
2020-07-27 21:32:51 -07:00
commit a9277bd199
123 changed files with 41995 additions and 0 deletions
+24
View File
@@ -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)
})