Skip to content

Commit d0b4a88

Browse files
committed
Redact my testing email
1 parent 44fb8c6 commit d0b4a88

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

tests/training-sheets/integration.test.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const TEST_USER = 1741;
2828

2929
const TEST_EQUIPMENT_ID = 'a008b6f2-3338-4339-a846-3b4f3d12fe3d' as UUID;
3030

31+
const REDACTED_EMAIL = '<EMAIL>';
32+
3133
const getEvents = async (trainingSheetId: string) => {
3234
const auth = new GoogleAuth({
3335
keyFile: CREDENTIALS_PATH,
@@ -82,6 +84,16 @@ const stripNonStatic = (
8284
})
8385
);
8486

87+
const redactEmail = (
88+
events: ReadonlyArray<EventOfType<'EquipmentTrainingQuizResult'>>
89+
): ReadonlyArray<EventOfType<'EquipmentTrainingQuizResult'>> =>
90+
pipe(
91+
events,
92+
RA.map(event =>
93+
event.emailProvided ? {...event, emailProvided: REDACTED_EMAIL} : event
94+
)
95+
);
96+
8597
describe('Google training sheet integration', () => {
8698
it.skip('Form 3 Resin Printer', async () => {
8799
const events = await getEvents(
@@ -110,6 +122,7 @@ describe('Google training sheet integration', () => {
110122
await getEvents('1Krto0mc2clINQJrM8ZJJh0P5hISjt1C3vnK2xQaBATM'),
111123
filterUserEvents(TEST_USER),
112124
RA.sort(ordByTimestampEpoch),
125+
redactEmail,
113126
stripNonStatic
114127
);
115128
const expected: typeof userEvents = [
@@ -118,7 +131,7 @@ describe('Google training sheet integration', () => {
118131
actor: {tag: 'system'},
119132
equipmentId: TEST_EQUIPMENT_ID,
120133
memberNumberProvided: TEST_USER,
121-
emailProvided: 'paul.la.lancaster@gmail.com',
134+
emailProvided: REDACTED_EMAIL,
122135
trainingSheetId: '1Krto0mc2clINQJrM8ZJJh0P5hISjt1C3vnK2xQaBATM',
123136
timestampEpochMS: 1736799191000,
124137
score: 6,
@@ -130,7 +143,7 @@ describe('Google training sheet integration', () => {
130143
actor: {tag: 'system'},
131144
equipmentId: TEST_EQUIPMENT_ID,
132145
memberNumberProvided: TEST_USER,
133-
emailProvided: 'paul.la.lancaster@gmail.com',
146+
emailProvided: REDACTED_EMAIL,
134147
trainingSheetId: '1Krto0mc2clINQJrM8ZJJh0P5hISjt1C3vnK2xQaBATM',
135148
timestampEpochMS: 1736799242000,
136149
score: 7,
@@ -146,6 +159,7 @@ describe('Google training sheet integration', () => {
146159
await getEvents('11S81Gb-QyFNaI_-RH3Xcrwqtyfd47z7l-lXUAB9SzEY'),
147160
filterUserEvents(TEST_USER),
148161
RA.sort(ordByTimestampEpoch),
162+
redactEmail,
149163
stripNonStatic
150164
);
151165
const expected: typeof userEvents = [
@@ -154,7 +168,7 @@ describe('Google training sheet integration', () => {
154168
actor: {tag: 'system'},
155169
equipmentId: TEST_EQUIPMENT_ID,
156170
memberNumberProvided: TEST_USER,
157-
emailProvided: 'paul.la.lancaster@gmail.com',
171+
emailProvided: REDACTED_EMAIL,
158172
trainingSheetId: '11S81Gb-QyFNaI_-RH3Xcrwqtyfd47z7l-lXUAB9SzEY',
159173
timestampEpochMS: 1725998724000,
160174
score: 180,
@@ -166,7 +180,7 @@ describe('Google training sheet integration', () => {
166180
actor: {tag: 'system'},
167181
equipmentId: TEST_EQUIPMENT_ID,
168182
memberNumberProvided: TEST_USER,
169-
emailProvided: 'paul.la.lancaster@gmail.com',
183+
emailProvided: REDACTED_EMAIL,
170184
trainingSheetId: '11S81Gb-QyFNaI_-RH3Xcrwqtyfd47z7l-lXUAB9SzEY',
171185
timestampEpochMS: 1725999015000,
172186
score: 200,

0 commit comments

Comments
 (0)