-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ipfs): Improved functions and unit tests, addded e2e test
- Loading branch information
1 parent
e8f59ea
commit fa984e0
Showing
4 changed files
with
116 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters