 # Assertions
 
 assertBundle = (services, bundle, errMsg) ->
-  runTransform transform(services, true)(bundleFile), 'data', (err, data) ->
+  runTransform transform(services, true)(servicesFile), 'data', (err, data) ->
     expect(err).toEqual(null)
     expect(data).toEqual(bundle)
 
 assertBundleFailed = (services, errMsg) ->
-  runTransform transform(services, true)(bundleFile), 'data', (err) ->
+  runTransform transform(services, true)(servicesFile), 'data', (err) ->
     expect(err.message).toEqual(errMsg)
 
 describe 'bundle transformer', ->


# Bundle helpers

bundleFile = bundleHelpers.servicesFile
header = 'var AWS = require("./core"); module.exports = AWS;'
buildBundle = (services) ->
  data = [header]

      expect(data).toEqual 'foo'

  it 'returns bundle if file is aws.js', ->
    runTransform transform(servicesFile), 'data', (e, data) ->
      expect(e).toEqual(null)
      expect(data).toEqual(defaultBundle)

  it 'uses SERVICES environment variable if services not initialized', ->
    process.env.SERVICES = 's3,cloudwatch'
    bundle = buildBundle s3: ['2006-03-01'], cloudwatch: ['2010-08-01']
    runTransform transform(servicesFile), 'data', (e, data) ->
      expect(e).toEqual(null)
      expect(data).toEqual(bundle)

