var ServiceProxy = require('../lib/proxy');
var assert = require('assert');

describe('ServiceProxy', function () {

  it('should create a proxy instance', function() {
    assert.notEqual(new ServiceProxy(), null);
  });

  it('should create a proxy instance even if new is missing', function() {
    assert.notEqual(require('../lib/proxy')(), null);
  });

  it('should create delegate methods', function() {
    var proxy = new ServiceProxy();
    var service = {};
    service.name = function() { return 'Name' };
    proxy.service = service;
    assert.equal(proxy.name(), 'Name');
  });

  it('should remove old methods when new service is set', function() {
    var proxy = new ServiceProxy();
    var service = {};
    service.name = function() { return 'Name' };
    proxy.service = service;
    proxy.service = {};
    assert.equal(proxy.name, undefined);
  });
});

@@ -864,13 +864,337 @@
 );%0A  %7D);
+%0A%0A  it('should create delegate values to original service instance', function() %7B%0A    var proxy = new ServiceProxy();%0A    var service = %7B%7D;%0A    service.name = 'Old value';%0A    proxy.service = service;%0A    assert.equal(proxy.name, 'Old value');%0A    proxy.name = 'New value';%0A    assert.equal(service.name, 'New value');%0A  %7D);
 %0A%7D);%0A

Add test