Commit 2a83a508 authored by Robert Knight's avatar Robert Knight

Make fake services/filters local to beforeEach() scope

Where a fake service/filter is not accessed directly
by any tests, make it local to beforeEach().

This reduces the surface area of globals exposed to all tests.
parent e1620fc8
...@@ -423,19 +423,12 @@ describe('annotation', function() { ...@@ -423,19 +423,12 @@ describe('annotation', function() {
var $timeout; var $timeout;
var $window; var $window;
var fakeAnnotationMapper; var fakeAnnotationMapper;
var fakeAnnotationUI;
var fakeDocumentDomainFilter;
var fakeDocumentTitleFilter;
var fakeDrafts; var fakeDrafts;
var fakeFeatures;
var fakeFlash; var fakeFlash;
var fakeGroups; var fakeGroups;
var fakePermissions; var fakePermissions;
var fakeSession; var fakeSession;
var fakeSettings;
var fakeTags;
var fakeTime; var fakeTime;
var fakeUrlEncodeFilter;
var sandbox; var sandbox;
function createDirective(annotation) { function createDirective(annotation) {
...@@ -572,7 +565,7 @@ describe('annotation', function() { ...@@ -572,7 +565,7 @@ describe('annotation', function() {
deleteAnnotation: sandbox.stub() deleteAnnotation: sandbox.stub()
}; };
fakeAnnotationUI = {}; var fakeAnnotationUI = {};
fakeDrafts = { fakeDrafts = {
update: sandbox.stub(), update: sandbox.stub(),
...@@ -580,7 +573,7 @@ describe('annotation', function() { ...@@ -580,7 +573,7 @@ describe('annotation', function() {
get: sandbox.stub() get: sandbox.stub()
}; };
fakeFeatures = { var fakeFeatures = {
flagEnabled: sandbox.stub().returns(true) flagEnabled: sandbox.stub().returns(true)
}; };
...@@ -608,11 +601,11 @@ describe('annotation', function() { ...@@ -608,11 +601,11 @@ describe('annotation', function() {
} }
}; };
fakeSettings = { var fakeSettings = {
serviceUrl: 'https://test.hypothes.is/', serviceUrl: 'https://test.hypothes.is/',
}; };
fakeTags = { var fakeTags = {
filter: sandbox.stub().returns('a while ago'), filter: sandbox.stub().returns('a while ago'),
store: sandbox.stub() store: sandbox.stub()
}; };
......
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