Skip to content

Commit

Permalink
Issue 1811: Don't mock DepositLocation in DepositLocationRepoControll…
Browse files Browse the repository at this point in the history
…er test.

The DepositLocationRepoController is defining methods on the DepositLocation model after loading.
This interferes with the ability to mock and then test code.

Solving this is out of scope of the current task and so this is a work-around to keep the coverage up.
  • Loading branch information
kaladay committed Jun 27, 2023
1 parent b5f8408 commit 6fd653f
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ describe("controller: DepositLocationRepoController", function () {
};

var initializeController = function(settings) {
inject(function ($controller, $rootScope, _DragAndDropListenerFactory_, _ModalService_, _PackagerRepo_, _RestApi_, _StorageService_) {
inject(function ($controller, $rootScope, _DepositLocation_, _DragAndDropListenerFactory_, _ModalService_, _PackagerRepo_, _RestApi_, _StorageService_) {
scope = $rootScope.$new();

sessionStorage.role = settings && settings.role ? settings.role : "ROLE_ADMIN";
sessionStorage.token = settings && settings.token ? settings.token : "faketoken";

DepositLocation = _DepositLocation_;

controller = $controller("DepositLocationRepoController", {
$q: q,
$scope: scope,
$window: mockWindow(),
DepositLocation: DepositLocation,
DepositLocation: _DepositLocation_,
DepositLocationRepo: DepositLocationRepo,
DragAndDropListenerFactory: _DragAndDropListenerFactory_,
ModalService: _ModalService_,
Expand All @@ -44,12 +46,6 @@ describe("controller: DepositLocationRepoController", function () {
beforeEach(function() {
module("core");
module("vireo");
module("mock.depositLocation", function($provide) {
DepositLocation = function() {
return mockedDepositLocation();
};
$provide.value("DepositLocation", DepositLocation);
});

module("mock.depositLocationRepo");
module("mock.dragAndDropListenerFactory");
Expand Down Expand Up @@ -213,9 +209,6 @@ describe("controller: DepositLocationRepoController", function () {
scope.modalData.testDepositLocation();
scope.$digest();

scope.modalData.mockTestConnectionPayload([
{ uri: "mockUri", name: "mockName" }
]);
scope.resetDepositLocation();
scope.modalData.testDepositLocation();
scope.$digest();
Expand Down

0 comments on commit 6fd653f

Please sign in to comment.