diff --git a/lib/copy-sync/__tests__/copy-sync-file.test.js b/lib/copy-sync/__tests__/copy-sync-file.test.js index 3442359..7d0dd4c 100644 --- a/lib/copy-sync/__tests__/copy-sync-file.test.js +++ b/lib/copy-sync/__tests__/copy-sync-file.test.js @@ -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'