Commit 2016c935 authored by Sean Hammond's avatar Sean Hammond Committed by GitHub

Merge pull request #448 from hypothesis/fix-angular-dup-warning

Fix warning about loading Angular twice in tests
parents 8b8ac608 a18bdaf6
......@@ -211,6 +211,7 @@ module.exports = angular.module('h', [
.value('ExcerptOverflowMonitor', require('./util/excerpt-overflow-monitor'))
.value('VirtualThreadList', require('./virtual-thread-list'))
.value('raven', require('./raven'))
.value('serviceConfig', serviceConfig)
.value('settings', settings)
.value('time', require('./time'))
.value('urlEncodeFilter', require('./filter/url').encode)
......
......@@ -4,7 +4,6 @@ var angular = require('angular');
var events = require('./events');
var retryUtil = require('./retry-util');
var serviceConfig = require('./service-config');
var CACHE_TTL = 5 * 60 * 1000; // 5 minutes
......@@ -45,7 +44,7 @@ function sessionActions(options) {
* @ngInject
*/
function session($http, $q, $resource, $rootScope, analytics, annotationUI, auth,
flash, raven, settings, store) {
flash, raven, settings, serviceConfig, store) {
// Headers sent by every request made by the session service.
var headers = {};
var actions = sessionActions({
......
'use strict';
var angular = require('angular');
var proxyquire = require('proxyquire');
var events = require('../events');
......@@ -15,7 +14,7 @@ describe('session', function () {
var fakeAuth;
var fakeFlash;
var fakeRaven;
var fakeServiceConfig = sinon.stub();
var fakeServiceConfig;
var fakeSettings;
var fakeStore;
var sandbox;
......@@ -23,10 +22,7 @@ describe('session', function () {
before(function () {
angular.module('h', ['ngResource'])
.service(
'session',
proxyquire('../session', {'./service-config': fakeServiceConfig})
);
.service('session', require('../session'));
});
beforeEach(function () {
......@@ -58,8 +54,7 @@ describe('session', function () {
update: sandbox.stub().returns(Promise.resolve({})),
},
};
fakeServiceConfig.reset();
fakeServiceConfig.returns(null);
fakeServiceConfig = sinon.stub().returns(null);
fakeSettings = {
serviceUrl: 'https://test.hypothes.is/root/',
};
......@@ -71,6 +66,7 @@ describe('session', function () {
flash: fakeFlash,
raven: fakeRaven,
settings: fakeSettings,
serviceConfig: fakeServiceConfig,
store: fakeStore,
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment