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

Commit

Permalink
test(refs): fix symlinks from git (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider authored and daviddias committed Dec 17, 2017
1 parent 012b86c commit 72a42d6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/refs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const isNode = require('detect-node')
const waterfall = require('async/waterfall')
const path = require('path')
const FactoryClient = require('./ipfs-factory/client')
const fs = require('fs')

describe('.refs', function () {
this.timeout(80 * 1000)
Expand All @@ -21,11 +22,21 @@ describe('.refs', function () {

before((done) => {
fc = new FactoryClient()
const filesPath = path.join(__dirname, '/fixtures/test-folder')

// Symlinks in a repo don't always clone well, especially on Windows.
// So if the 'hello-link' is not a symlink, then make it one.
const symlinkPath = filesPath + '/hello-link'
const symlinkTarget = 'files/hello.txt'
if (!fs.lstatSync(symlinkPath).isSymbolicLink()) {
fs.unlinkSync(symlinkPath)
fs.symlinkSync(symlinkTarget, symlinkPath)
}

waterfall([
(cb) => fc.spawnNode(cb),
(node, cb) => {
ipfs = node
const filesPath = path.join(__dirname, '/fixtures/test-folder')
ipfs.util.addFromFs(filesPath, { recursive: true }, cb)
},
(hashes, cb) => {
Expand Down

0 comments on commit 72a42d6

Please sign in to comment.