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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: refactor for test sanity (#733)
- Loading branch information
Showing
56 changed files
with
159 additions
and
298 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
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.