Skip to content

Commit

Permalink
Merge pull request #189 from bartland/WindowsMoveTestsFix
Browse files Browse the repository at this point in the history
move.test fix to support CRLF on Windows
  • Loading branch information
jprichardson committed Oct 31, 2015
2 parents c4e00ad + 22c19fe commit d3b2e03
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions lib/move/__tests__/move.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ describe('move', function () {
fse.move(src, dest, function (err) {
assert.ifError(err)
fs.readFile(dest, 'utf8', function (err, contents) {
var expected = /^sonic the hedgehog\r?\n$/
assert.ifError(err)
assert.strictEqual(contents, 'sonic the hedgehog\n')
assert.ok(contents.match(expected), contents + ' match ' + expected)
done()
})
})
Expand Down Expand Up @@ -103,8 +104,9 @@ describe('move', function () {
fse.move(src, dest, function (err) {
assert.ifError(err)
fs.readFile(dest, 'utf8', function (err, contents) {
var expected = /^sonic the hedgehog\r?\n$/
assert.ifError(err)
assert.strictEqual(contents, 'sonic the hedgehog\n')
assert.ok(contents.match(expected), contents + ' match ' + expected)
done()
})
})
Expand All @@ -121,8 +123,9 @@ describe('move', function () {
assert.strictEqual(fs.link.callCount, 1)

fs.readFile(dest, 'utf8', function (err, contents) {
var expected = /^sonic the hedgehog\r?\n$/
assert.ifError(err)
assert.strictEqual(contents, 'sonic the hedgehog\n')
assert.ok(contents.match(expected), contents + ' match ' + expected)

tearDownMockFs()
done()
Expand All @@ -140,8 +143,9 @@ describe('move', function () {
fse.move(src, dest, function (err) {
assert.ifError(err)
fs.readFile(dest + '/another-file', 'utf8', function (err, contents) {
var expected = /^tails\r?\n$/
assert.ifError(err)
assert.strictEqual(contents, 'tails\n')
assert.ok(contents.match(expected), contents + ' match ' + expected)
done()
})
})
Expand All @@ -158,8 +162,9 @@ describe('move', function () {
assert.strictEqual(fs.link.callCount, 1)

fs.readFile(dest + '/another-folder/file3', 'utf8', function (err, contents) {
var expected = /^knuckles\r?\n$/
assert.ifError(err)
assert.strictEqual(contents, 'knuckles\n')
assert.ok(contents.match(expected), contents + ' match ' + expected)

tearDownMockFs('EISDIR')

Expand All @@ -181,8 +186,9 @@ describe('move', function () {
assert.strictEqual(fs.rename.callCount, 1)

fs.readFile(dest + '/another-folder/file3', 'utf8', function (err, contents) {
var expected = /^knuckles\r?\n$/
assert.ifError(err)
assert.strictEqual(contents, 'knuckles\n')
assert.ok(contents.match(expected), contents + ' match ' + expected)

tearDownMockFs('EXDEV')

Expand All @@ -202,8 +208,9 @@ describe('move', function () {
assert.strictEqual(fs.link.callCount, 1)

fs.readFile(dest + '/another-folder/file3', 'utf8', function (err, contents) {
var expected = /^knuckles\r?\n$/
assert.ifError(err)
assert.strictEqual(contents, 'knuckles\n')
assert.ok(contents.match(expected), contents + ' match ' + expected)

tearDownMockFs()

Expand Down

0 comments on commit d3b2e03

Please sign in to comment.