mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-18 16:13:55 +00:00
* BREAKING: Drop old Node support, require v10+ Update CI configs * Remove references and test fencing for old Node versions * Use object spread properties * Use octal literal notation * Use optional catch bindings
30 lines
699 B
JavaScript
30 lines
699 B
JavaScript
'use strict'
|
|
|
|
const os = require('os')
|
|
const fse = require('../..')
|
|
const path = require('path')
|
|
const assert = require('assert')
|
|
|
|
/* eslint-env mocha */
|
|
|
|
describe('fs.copyFile', () => {
|
|
let TEST_DIR
|
|
|
|
beforeEach(done => {
|
|
TEST_DIR = path.join(os.tmpdir(), 'fs-extra', 'fs-copyfile')
|
|
fse.emptyDir(TEST_DIR, done)
|
|
})
|
|
|
|
afterEach(done => fse.remove(TEST_DIR, done))
|
|
|
|
it('supports promises', () => {
|
|
const src = path.join(TEST_DIR, 'init.txt')
|
|
const dest = path.join(TEST_DIR, 'copy.txt')
|
|
fse.writeFileSync(src, 'hello')
|
|
return fse.copyFile(src, dest).then(() => {
|
|
const data = fse.readFileSync(dest, 'utf8')
|
|
assert.strictEqual(data, 'hello')
|
|
})
|
|
})
|
|
})
|