This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
test: refactor for test sanity #733
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,3 @@ module.exports = { | |
}] | ||
} | ||
} | ||
|
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 was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,81 @@ | ||
/* eslint max-nested-callbacks: ["error", 8] */ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const expect = require('chai').expect | ||
const isNode = require('detect-node') | ||
const IPFS = require('../../src/core') | ||
|
||
// This gets replaced by require('../utils/create-repo-browser.js') | ||
// in the browser | ||
const createTempRepo = require('../utils/create-repo-node.js') | ||
|
||
describe('init', () => { | ||
if (!isNode) { return } | ||
|
||
let ipfs | ||
let repo | ||
|
||
beforeEach(() => { | ||
repo = createTempRepo() | ||
ipfs = new IPFS(repo) | ||
}) | ||
|
||
afterEach((done) => repo.teardown(done)) | ||
|
||
it('basic', (done) => { | ||
ipfs.init({ bits: 1024 }, (err) => { | ||
expect(err).to.not.exist | ||
|
||
repo.exists((err, res) => { | ||
expect(err).to.not.exist | ||
expect(res).to.equal(true) | ||
|
||
repo.config.get((err, config) => { | ||
expect(err).to.not.exist | ||
expect(config.Identity).to.exist | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
it('set # of bits in key', (done) => { | ||
ipfs.init({ bits: 2048 }, (err) => { | ||
expect(err).to.not.exist | ||
|
||
repo.config.get((err, config) => { | ||
expect(err).to.not.exist | ||
expect(config.Identity.PrivKey.length).is.above(256) | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
it('init docs are written', (done) => { | ||
ipfs.init({ bits: 1024 }, (err) => { | ||
expect(err).to.not.exist | ||
const multihash = new Buffer('12205e7c3ce237f936c76faf625e90f7751a9f5eeb048f59873303c215e9cce87599', 'hex') | ||
|
||
ipfs.object.get(multihash, {}, (err, node) => { | ||
expect(err).to.not.exist | ||
expect(node.links).to.exist | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
it('empty repo', (done) => { | ||
ipfs.init({ bits: 1024, emptyRepo: true }, (err) => { | ||
expect(err).to.not.exist | ||
|
||
// Should not have default assets | ||
const multihash = new Buffer('12205e7c3ce237f936c76faf625e90f7751a9f5eeb048f59873303c215e9cce87599', 'hex') | ||
|
||
ipfs.object.get(multihash, {}, (err, node) => { | ||
expect(err).to.exist | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,17 @@ | ||
/* eslint-env mocha */ | ||
|
||
'use strict' | ||
|
||
const isNode = require('detect-node') | ||
|
||
describe('interface-ipfs-core tests', () => { | ||
require('./block') | ||
require('./config') | ||
require('./files') | ||
require('./generic') | ||
require('./object') | ||
if (isNode) { | ||
require('./swarm') | ||
require('./pubsub') | ||
} | ||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this just be create-repo rather?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it could, I just standardize it because we always tag
node
andbrowser
everywhere to distinguish the two, if distinction needs to happenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!