 	'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')
+		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:

testBoth(
	'should read a config.json from a raspberrypi'
	(input) ->
		imagefs.read(input).then(utils.extract).then (contents) ->
			utils.expect(JSON.parse(contents), files.raspberrypi['config.json'])
	{
		image: RASPBERRYPI

testBoth(
	'should copy files between different partitions in a raspberrypi'
	(input, output) ->
		imagefs.copy(input, output)
		.then(utils.waitStream)
		.then ->
			imagefs.read(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')
	{
		image: RASPBERRYPI
		partition:
