'use strict';

goog.require('goog.net.XhrIo');
goog.require('goog.Promise');

describe('The API server', function(){
  this.timeout(5000);

  describe('/users/:username/contributions.json', function(){
    before(function(){
      this.subjectFunction = function(){
        return new goog.Promise(function(resolve){
          goog.net.XhrIo.send(
            '/users/igrep/contributions.json',
            function(event){ resolve(event.target); },
            'GET'
          );
        });
      };
    });

    it('returns a JSON with 200 OK', function(done){
      this.subjectFunction().then(function(xhr){
        let responseJson = xhr.getResponseJson();
        expect(responseJson).to.be.an('object');
        expect(responseJson).not.to.be.empty();

        expect(xhr.getStatus()).to.be(200);

        done();
      });
    });
  });
});

@@ -203,123 +203,57 @@
     
-before(function()%7B%0A      this.subjectFunction = function()%7B%0A        return new goog.Promise(function(resolve)%7B%0A    
+it('returns a JSON with 200 OK', function(done)%7B%0A
     
@@ -283,20 +283,16 @@
         
- 
-   
 '/users/
@@ -326,20 +326,16 @@
         
-    
 function
@@ -346,198 +346,45 @@
 nt)%7B
- resolve(event.target); %7D,%0A            'GET'%0A          );%0A        %7D);%0A      %7D;%0A    %7D);%0A%0A    it('returns a JSON with 200 OK', function(done)%7B%0A      this.subjectFunction().then(function(xhr)%7B%0A
+%0A          let xhr = event.target;%0A  
     
@@ -425,24 +425,26 @@
 onseJson();%0A
+  
         expe
@@ -480,32 +480,34 @@
 ject');%0A        
+  
 expect(responseJ
@@ -535,24 +535,26 @@
 );%0A%0A        
+  
 expect(xhr.g
@@ -586,16 +586,18 @@
         
+ 
+ 
 done();%0A
@@ -598,25 +598,49 @@
 ne();%0A      
-%7D
+  %7D,%0A        'GET'%0A      
 );%0A    %7D);%0A 

fix test error