From 80e3f049d784e86d0861270b34550d4785a8cb5d Mon Sep 17 00:00:00 2001 From: M Fahru Date: Tue, 17 Dec 2024 08:08:54 -0700 Subject: [PATCH] Merge pull request #22082 from overleaf/mf-remove-is-split-test-active [web] Remove `isSplitTestActive` function since it is no longer used GitOrigin-RevId: 81f3f61f14bb10d403fa72a61dc4a304c191512f --- .../Features/SplitTests/SplitTestHandler.js | 11 -------- .../src/SplitTests/SplitTestHandlerTests.js | 26 ------------------- 2 files changed, 37 deletions(-) diff --git a/services/web/app/src/Features/SplitTests/SplitTestHandler.js b/services/web/app/src/Features/SplitTests/SplitTestHandler.js index 02321aac2e..bc80bd0d6a 100644 --- a/services/web/app/src/Features/SplitTests/SplitTestHandler.js +++ b/services/web/app/src/Features/SplitTests/SplitTestHandler.js @@ -582,16 +582,6 @@ async function _getSplitTest(name) { } } -async function isSplitTestActive(splitTestName) { - try { - const splitTest = await _getSplitTest(splitTestName) - const currentVersion = SplitTestUtils.getCurrentVersion(splitTest) - return currentVersion?.active - } catch (e) { - logger.log('unable to check if split test is active ', splitTestName) - } -} - module.exports = { getPercentile, getAssignment: callbackify(getAssignment), @@ -607,6 +597,5 @@ module.exports = { getAssignmentForUser, getOneTimeAssignment, getActiveAssignmentsForUser, - isSplitTestActive, }, } diff --git a/services/web/test/unit/src/SplitTests/SplitTestHandlerTests.js b/services/web/test/unit/src/SplitTests/SplitTestHandlerTests.js index 5fed9b0271..5ff85c11ec 100644 --- a/services/web/test/unit/src/SplitTests/SplitTestHandlerTests.js +++ b/services/web/test/unit/src/SplitTests/SplitTestHandlerTests.js @@ -311,32 +311,6 @@ describe('SplitTestHandler', function () { ) }) }) - - describe('isSplitTestActive', function () { - it('returns false when current version is not active', async function () { - const res = - await this.SplitTestHandler.promises.isSplitTestActive( - 'not-active-test' - ) - expect(res).to.be.false - }) - it('returns undefined false when current version is active', async function () { - const res = - await this.SplitTestHandler.promises.isSplitTestActive('active-test') - expect(res).to.be.true - }) - it('returns undefined when there is an error checking', async function () { - this.SplitTestCache.get.rejects(new Error('oops')) - const res = - await this.SplitTestHandler.promises.isSplitTestActive('active-test') - expect(res).to.be.undefined - }) - it('returns undefined when there is no test', async function () { - const res = - await this.SplitTestHandler.promises.isSplitTestActive('not-a-test') - expect(res).to.be.undefined - }) - }) }) function makeSplitTest(