 	'should replace a file in an edison partition'
 	(output) ->
 		inputStream = fs.createReadStream(LOREM)
-		imagefs.write(output, inputStream).then(utils.waitStream).then ->
-			imagefs.replace(output, 'Lorem', 'Elementum').then(utils.waitStream).then ->
-				imagefs.read(output).then(utils.extract).then (contents) ->
-					utils.expect(contents, 'Elementum ipsum dolor sit amet\n')
+		imagefs.write(output, inputStream)
+		.then(utils.waitStream)
+		.then ->
+			imagefs.replace(output, 'Lorem', 'Elementum')
+		.then(utils.waitStream)
+		.then ->
+			imagefs.read(output)
+		.then(utils.extract)
+		.then (contents) ->
+			utils.expect(contents, 'Elementum ipsum dolor sit amet\n')
 	{
 		image: EDISON
 		path: '/lorem.txt'

	'should copy a local file to a raspberry pi partition'
	(output) ->
		inputStream = fs.createReadStream(LOREM)
		imagefs.write(output, inputStream).then(utils.waitStream).then ->
			imagefs.read(output).then(utils.extract).then (contents) ->
				utils.expect(contents.replace('\r', ''), 'Lorem ipsum dolor sit amet\n')
	{
		image: RASPBERRYPI
		partition:

		output = path.join(__dirname, 'output.tmp')
		imagefs.read(input).then (inputStream) ->
			return inputStream.pipe(fs.createWriteStream(output))
		.then(utils.waitStream)
		.then ->
			fs.createReadStream(output)
		.then(utils.extract)
		.then (contents) ->
			utils.expect(contents, 'dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait \n')
			fs.unlinkAsync(output)
	{
