Skip to content

Commit

Permalink
Rename tracker in tests
Browse files Browse the repository at this point in the history
tracker is an object that comes directly from google. This is why the `get`
method call has been kept on it, it's not a jQ object so the method is
defined by google rather than jQ. I've renamed the `tracker` object in the
tests to make it more obvious that it's something we don't have ownership
over
  • Loading branch information
JonathanHallam committed Nov 4, 2021
1 parent 8ed4848 commit 3d40e41
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/javascripts/set-ga-client-id-on-form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ var $ = window.jQuery

describe('SetGaClientIdOnForm', function () {
var GOVUK = window.GOVUK
var tracker = { clientId: 'clientId' }
tracker.get = function (arg) { return this[arg] }
window.ga = function (callback) { callback(tracker) }
var mockTracker = { clientId: 'clientId' }
mockTracker.get = function (arg) { return this[arg] }
window.ga = function (callback) { callback(mockTracker) }
var form

beforeEach(function () {
Expand Down

0 comments on commit 3d40e41

Please sign in to comment.