Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

object api tests #2

Merged
merged 1 commit into from
May 13, 2016
Merged

object api tests #2

merged 1 commit into from
May 13, 2016

Conversation

daviddias
Copy link
Contributor

WIP.. this is going to be big

@dignifiedquire
Copy link
Contributor

Also need tests for

ipfs.object.put(new Buffer('hello'), {enc: 'json'})
ipfs.object.put(new Buffer('hello'), {enc: 'yaml'})

@daviddias
Copy link
Contributor Author

ipfs.object.put(new Buffer('hello'), {enc: 'json'})

Not sure how this would work, if we say that the Buffer has json or yaml encoding, shouldn't it be complete? Passing it through the HTTP-API makes it fail, I've made a test for it:

https://github.com/ipfs/interface-ipfs-core/pull/2/files#diff-eaac2b5121380ed7f166ff7fe9e32c5bR108

The test that I have and that works as expect is:

https://github.com/ipfs/interface-ipfs-core/pull/2/files#diff-eaac2b5121380ed7f166ff7fe9e32c5bR45

@daviddias daviddias force-pushed the tests/object-api branch 2 times, most recently from a2954b8 to d06008f Compare May 13, 2016 10:12
it.skip('object.put of buffer and enc json', (done) => {
const buf = new Buffer('Some data')

ipfs.object.put(buf, { enc: 'json' }, (err, node) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant sth like this:

const buf = new Buffer(JSON.stringify({Data: 'hello world', Links: ['some link']}))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also the same with a yaml version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, the first one is already there, just missing the yaml one then

@daviddias daviddias force-pushed the tests/object-api branch 3 times, most recently from 1af3f0c to 6306abd Compare May 13, 2016 12:40
it('object.stat with multihash base58 encoded toString', (done) => {
const testObj = {
Data: new Buffer('get test object'),
Links: []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a test with links, to ensure the returned stats are correct

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point! thank you :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@daviddias
Copy link
Contributor Author

tests complete and also js-ipfs-api is compatible with all this tests now :)

@daviddias
Copy link
Contributor Author

Merging as this code got several reviews by @dignifiedquire :)

@daviddias daviddias merged commit ad99ac9 into master May 13, 2016
@daviddias daviddias deleted the tests/object-api branch May 13, 2016 14:01
it('object.data', (done) => {
ipfs.object.data(testObjectHash, (err, res) => {
// TODO verify that yaml encoded buffers still work in go-ipfs
it.skip('object.put of yaml encoded buffer', (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diasdavid yaml was never available, json and protobuf are the supported encodings according to the help section

   Data should be in the format specified by the --inputenc flag.
    --inputenc may be one of the following:
        * "protobuf"
        * "json" (default)

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.

2 participants