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.
- Loading branch information
Showing
13 changed files
with
197 additions
and
23 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,73 @@ | ||
module.exports = function (config) { | ||
config.set({ | ||
|
||
// base path, that will be used to resolve files and exclude | ||
basePath: '', | ||
|
||
// frameworks to use | ||
frameworks: ['mocha'], | ||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
'tests/test-core/browser.js' | ||
], | ||
|
||
// list of preprocessors | ||
preprocessors: { | ||
'tests/test-core/*': ['webpack'] | ||
}, | ||
|
||
webpack: { | ||
resolve: { | ||
extensions: ['', '.js'] | ||
}, | ||
externals: { | ||
fs: '{}' | ||
}, | ||
node: { | ||
Buffer: true | ||
} | ||
}, | ||
|
||
webpackMiddleware: { | ||
noInfo: true, | ||
stats: { | ||
colors: true | ||
} | ||
}, | ||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' | ||
reporters: ['spec'], | ||
|
||
// web server port | ||
port: 9876, | ||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: false, | ||
|
||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera (has to be installed with `npm install karma-opera-launcher`) | ||
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) | ||
// - PhantomJS | ||
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) | ||
browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'], | ||
|
||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 60000, | ||
|
||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun: true | ||
}) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
const localStorage = require('local-storage-blob-store') | ||
const IPFSRepo = require('ipfs-repo') | ||
|
||
const options = { | ||
stores: { | ||
keys: localStorage, | ||
config: localStorage, | ||
datastore: localStorage, | ||
// datastoreLegacy: needs https://github.com/ipfs/js-ipfs-repo/issues/6#issuecomment-164650642 | ||
logs: localStorage, | ||
locks: localStorage, | ||
version: localStorage | ||
} | ||
} | ||
|
||
module.exports = () => { | ||
return new IPFSRepo('ipfs', options) | ||
} |
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,5 @@ | ||
const isNode = !global.window | ||
|
||
module.exports = isNode | ||
? require('./node') | ||
: require('./browser') |
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,22 @@ | ||
'use strict' | ||
|
||
const os = require('os') | ||
const fs = require('fs-blob-store') | ||
const IPFSRepo = require('ipfs-repo') | ||
|
||
const options = { | ||
stores: { | ||
keys: fs, | ||
config: fs, | ||
datastore: fs, | ||
// datastoreLegacy: needs https://github.com/ipfs/js-ipfs-repo/issues/6#issuecomment-164650642 | ||
logs: fs, | ||
locks: fs, | ||
version: fs | ||
} | ||
} | ||
|
||
module.exports = () => { | ||
const repoPath = process.env.IPFS_PATH || os.homedir() + '/.ipfs' | ||
return new IPFSRepo(repoPath, options) | ||
} |
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,44 @@ | ||
/* globals describe, before */ | ||
|
||
// const expect = require('chai').expect | ||
const async = require('async') | ||
const store = require('local-storage-blob-store') | ||
const _ = require('lodash') | ||
|
||
var repoContext = require.context('raw!../repo-example', true) | ||
|
||
describe('core', function () { | ||
before(function (done) { | ||
window.localStorage.clear() | ||
|
||
var repoData = [] | ||
repoContext.keys().forEach(function (key) { | ||
repoData.push({ | ||
key: key.replace('./', ''), | ||
value: repoContext(key) | ||
}) | ||
}) | ||
|
||
var mainBlob = store('ipfs') | ||
var blocksBlob = store('ipfs/') | ||
|
||
async.eachSeries(repoData, (file, cb) => { | ||
if (_.startsWith(file.key, 'datastore/')) { | ||
return cb() | ||
} | ||
|
||
const blob = _.startsWith(file.key, 'blocks/') | ||
? blocksBlob | ||
: mainBlob | ||
|
||
blob.createWriteStream({ | ||
key: file.key | ||
}).end(file.value, cb) | ||
}, done) | ||
}) | ||
|
||
const testsContext = require.context('.', true, /test-*/) | ||
testsContext | ||
.keys() | ||
.forEach(key => testsContext(key)) | ||
}) |
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 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