Skip to content

Commit

Permalink
Merge pull request jprichardson#317 from weexpectedTHIS/master
Browse files Browse the repository at this point in the history
Adding copy sync test for src file without write perms
  • Loading branch information
jprichardson authored Nov 15, 2016
2 parents 9d67a5d + e785645 commit ac89f5a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/copy-sync/__tests__/copy-sync-file.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ describe('+ copySync()', function () {
})
})

describe('> when the source file does not have write permissions', function () {
it('should be able to copy contents of file', function () {
var fileSrc = path.join(TEST_DIR, 'file.txt')
var fileDest = path.join(TEST_DIR, 'file-copy.txt')
var data = 'did it copy?'

fs.writeFileSync(fileSrc, data, 'utf8')
fs.chmodSync(fileSrc, '0444')

fs.copySync(fileSrc, fileDest)

var data2 = fs.readFileSync(fileDest, 'utf8')

assert.strictEqual(data, data2)
})
})

describe('> when clobber option is passed', function () {
var src, dest
var srcData = 'some src data'
Expand Down

0 comments on commit ac89f5a

Please sign in to comment.