     expect(n.packages[0].summary).toBe( 'query and manipulate user account information' )
 
   it 'should be a able to fetch /packages', () ->
-    packages = [
-      { 'name': 'xx', 'versions': [
-          {'version':'1.0','id':'xx10'}
-        ]
-      },
-      { 'name': 'yy', 'versions': [
-          {'version':'1.1','id':'yy11'},
-          {'version':'1.2','id':'yy12'}
-        ]
-      }
-    ]
-    paginateResponse @httpBackend, '/v1/packages', packages, () -> scope.fetchPackages()
-
-    expect(scope.packages.length).toBe(2)
+    ps = allPackages1
+    paginateResponse @httpBackend, '/v1/packages', ps, () -> scope.fetchPackages()
+
+    expect(scope.packages.length).toBe(ps.length)
     # test both packages
     for idx in [0,1]
-      ps = scope.packages[idx]
-      expect(@typeOf(ps)).toBe('object')
-      expect(ps.name).toBe(packages[idx].name)
-      expect(ps.versions.length).toBe(packages[idx].versions.length)
+      res_p = scope.packages[idx]
+      expect(@typeOf(res_p)).toBe('object')
+      expect(res_p.name).toBe(ps[idx].name)
+      expect(res_p.versions.length).toBe(ps[idx].versions.length)
 
       # every package we load creates an entry in the package map
-      for v in ps.versions
+      for v in res_p.versions
         p = scope.package[v.id]
         expect(@typeOf(p)).toBe('object')
-        expect(p.name).toBe(packages[idx].name)
+        expect(p.name).toBe(ps[idx].name)
         expect(p.version).toBe(v.version)
         expect(p.versions).toBe(undefined)
 

  afterEach () ->
    @httpBackend.verifyNoOutstandingExpectation()
    @httpBackend.verifyNoOutstandingRequest()

  it 'should have no default host configured', () ->
    expect(scope.ponyExpressHost).toBe(undefined)

    expect(p.provider).toBe(r.provider)
    expect(p.archive).toBe(r.archive)
    expect(p.nodes).toBe(r.nodes)

  it 'should provide all packages if no node is selected', () ->
    scope.allPackages = allPackages1
    scope.updatePackageSelection()
    expect( scope.packages ).toBe( scope.allPackages )

  it 'should provide only the packages assigned to a selected node', () ->
    scope.allPackages = allPackages1
    scope.node['n'] = {}
    scope.node['n'].packages = [ { 'id': allPackages1[0].versions[0].id } ]
    scope.nodeSelected['n'] = true
    scope.updatePackageSelection()
    expect( scope.packages.length ).toBe( 1 )
    expect( scope.packages[0].name ).toBe( allPackages1[0].name )
