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

    waitsFor -> err || tr
    runs ->
      expect(err.message).toEqual('Missing modules: invalidmodule')
      runTransform tr(bundleFile), 'data', (e, out) ->
        expect(e.message).toEqual(err.message)
        expect(out).toEqual(null)

      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)

