Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Ipfs cli tests #8

Closed
wants to merge 3 commits into from
Closed

Conversation

andrewdeandrade
Copy link
Contributor

Basic ipfs-cli tests. Currently covers all the commands in the readme. There is a fair amount of repetition in the test file right now.

I've seen this repetition before with CLI tests with isaacs/node-tap that I contribute to. IMHO the right solution is a generalized TAP test tool for CLIs like sstephenson/bats, but without having to use bash (ugghh!). I may end up making such a tool at some point, at which time I'll revisit these tests and DRY everything up.

MicrowaveDev pushed a commit to galtproject/js-ipfs that referenced this pull request May 22, 2020
* feat: consolidate ipfs.add input normalisation

Allows input normalisation function to be shared between ipfs and the
http client.

* feat: support pull streams (ipfs#8)

* feat: support pull streams

This PR updates the `normaliseInput` function to accept pull streams.

I've also made the following changes:

1. Update the docs for supported inputs
  * `Buffer|ArrayBuffer|TypedArray` is aliased as `Bytes`
  * `Blob|File` is aliased as `Bloby`
  * Added info for what a input "means" i.e. causes single/multiple files to be added
1. Peek the first item of an (async) iterator properly
1. Move file object check below `input[Symbol.asyncIterator]` check because Node.js streams have a path property that will false positive the `isFileObject` check
1. Fix `toFileObject` to allow objects with no `content` property
1. Simplify `toBuffer` to remove checks that `Buffer.from` already does
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant