Commit b8d64a48 authored by Robert Knight's avatar Robert Knight

Convert service-url-test mocking to babel-plugin-mockable-imports

parent 5b585817
'use strict'; 'use strict';
const proxyquire = require('proxyquire'); const serviceUrlFactory = require('../service-url');
/** Return a fake store object. */ /** Return a fake store object. */
function fakeStore() { function fakeStore() {
...@@ -20,7 +20,7 @@ function createServiceUrl(linksPromise) { ...@@ -20,7 +20,7 @@ function createServiceUrl(linksPromise) {
.stub() .stub()
.returns({ url: 'EXPANDED_URL', params: {} }); .returns({ url: 'EXPANDED_URL', params: {} });
const serviceUrlFactory = proxyquire('../service-url', { serviceUrlFactory.$imports.$mock({
'../util/url-util': { replaceURLParams: replaceURLParams }, '../util/url-util': { replaceURLParams: replaceURLParams },
}); });
...@@ -45,6 +45,7 @@ describe('sidebar.service-url', function() { ...@@ -45,6 +45,7 @@ describe('sidebar.service-url', function() {
afterEach(function() { afterEach(function() {
console.warn.restore(); console.warn.restore();
serviceUrlFactory.$imports.$restore();
}); });
context('before the API response has been received', function() { context('before the API response has been received', function() {
......
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