//= require spec_helper
describe('URLGenerator', function() {
  var urlGenerator;
  beforeEach(inject(function(_URLGenerator_) {
    urlGenerator = _URLGenerator_;
  }));

  it('allows urls with custom paths, no trailing slash', function() {
    ['http://promdash.server.com/prometheus', 'http://promdash.com'].forEach(function(s) {
      ['/api/query_range', '/api/query', '/api/metrics', '/arbitrary/endpoint'].forEach(function(ep) {
        var s = 'http://promdash.server.com/prometheus';
        var url = urlGenerator(s, ep);
        expect(url).toEqual(s + ep);
      });
    });
  });

  it('allows urls with custom paths, with trailing slash', function() {
    ['http://promdash.server.com/prometheus/', 'http://promdash.com/'].forEach(function(s) {
      ['/api/query_range', '/api/query', '/api/metrics', '/arbitrary/endpoint'].forEach(function(ep) {
        var s = 'http://promdash.server.com/prometheus/';
        var url = urlGenerator(s, ep);
        expect(url).toEqual(s.substring(0, s.length - 1) + ep);
      });
    });
  });
});

@@ -433,65 +433,8 @@
 ) %7B%0A
-        var s = 'http://promdash.server.com/prometheus';%0A
     
@@ -802,66 +802,8 @@
 ) %7B%0A
-        var s = 'http://promdash.server.com/prometheus/';%0A
     

Remove errant local variables