Skip to content

Commit 8b0022e

Browse files
committed
upgrades (3)
1 parent f39ea0e commit 8b0022e

File tree

6 files changed

+308
-155
lines changed

6 files changed

+308
-155
lines changed

src/server/api/auxiaProxyRouter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import type express from 'express';
22
import { Router } from 'express';
33
import { isProd } from '../lib/env';
44
import { bodyContainsAllFields } from '../middleware';
5-
import { getTreatmentsRequestPayloadToGateType } from '../signin-gate/dispatch';
65
import {
76
callAuxiaLogTreatmentInteration,
87
gateTypeToUserTreatmentsEnvelop,
98
} from '../signin-gate/libEffect';
10-
import { userTreatmentsEnvelopToProxyGetTreatmentsAnswerData } from '../signin-gate/libPure';
9+
import { getTreatmentsRequestPayloadToGateType, userTreatmentsEnvelopToProxyGetTreatmentsAnswerData } from '../signin-gate/libPure';
1110
import type { GetTreatmentsRequestPayload } from '../signin-gate/types';
1211
import { getSsmValue } from '../utils/ssm';
1312

src/server/signin-gate/dispatch.ts

Lines changed: 0 additions & 107 deletions
This file was deleted.

src/server/signin-gate/libPure.test.ts

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { getTreatmentsRequestPayloadToGateType } from './dispatch';
21
import {
32
articleIdentifierIsAllowed,
43
buildGetTreatmentsRequestPayload,
54
buildGuUserTreatmentsEnvelop,
65
buildLogTreatmentInteractionRequestPayload,
6+
getTreatmentsRequestPayloadToGateType,
77
gtrpIsAuxiaAudienceShare,
88
gtrpIsGuardianAudienceShare,
99
gtrpIsStaffTestConditionShowDefaultGate,
10+
gtrpUserHasConsented,
1011
guDismissibleUserTreatment,
1112
guMandatoryUserTreatment,
1213
isValidContentType,
@@ -872,3 +873,45 @@ describe('staffTestConditionToDefaultGate', () => {
872873
};
873874
expect(staffTestConditionToDefaultGate(payload4)).toBe('GuMandatory');
874875
});
876+
877+
describe('gtrpUserHasConsented', () => {
878+
const payload1: GetTreatmentsRequestPayload = {
879+
browserId: 'sample',
880+
isSupporter: false,
881+
dailyArticleCount: 3,
882+
articleIdentifier: 'sample: article identifier',
883+
editionId: 'UK',
884+
contentType: 'Article',
885+
sectionId: 'uk-news',
886+
tagIds: ['type/article'],
887+
gateDismissCount: 0,
888+
countryCode: 'GB',
889+
mvtId: 250001,
890+
should_show_legacy_gate_tmp: true,
891+
hasConsented: true,
892+
shouldServeDismissible: false,
893+
showDefaultGate: undefined,
894+
gateDisplayCount: 0,
895+
};
896+
expect(gtrpUserHasConsented(payload1)).toBe(true);
897+
898+
const payload2: GetTreatmentsRequestPayload = {
899+
browserId: 'sample',
900+
isSupporter: false,
901+
dailyArticleCount: 3,
902+
articleIdentifier: 'sample: article identifier',
903+
editionId: 'UK',
904+
contentType: 'Article',
905+
sectionId: 'uk-news',
906+
tagIds: ['type/article'],
907+
gateDismissCount: 0,
908+
countryCode: 'GB',
909+
mvtId: 450001,
910+
should_show_legacy_gate_tmp: true,
911+
hasConsented: false,
912+
shouldServeDismissible: true,
913+
showDefaultGate: 'true',
914+
gateDisplayCount: 0,
915+
};
916+
expect(gtrpUserHasConsented(payload2)).toBe(false);
917+
});

0 commit comments

Comments
 (0)