Skip to content

Commit

Permalink
extra insurance that urbanstats.org isn't included in quiz tests as a…
Browse files Browse the repository at this point in the history
… host (#942)

it doesn't seem to be an actual issue*, but there's no point in risking
polluting the database. Might also throw off

*as pretty decisive evidence, there's no spikes at 99 or 100 despite
those being common test examples
  • Loading branch information
kavigupta authored Feb 11, 2025
1 parent 02ab1be commit 9dd849a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions react/test/quiz_test_template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ export function quizTest({ platform }: { platform: 'desktop' | 'mobile' }): void
(user integer, day integer, corrects integer, time integer, PRIMARY KEY (user, day));
CREATE TABLE IF NOT EXISTS JuxtaStatUserDomain (user integer PRIMARY KEY, domain text);
INSERT INTO JuxtastatUserDomain VALUES (7, 'urbanstats.org');
INSERT INTO JuxtastatUserDomain VALUES (8, 'urbanstats.org');
INSERT INTO JuxtastatUserDomain VALUES (7, 'testproxy.nonexistent');
INSERT INTO JuxtastatUserDomain VALUES (8, 'testproxy.nonexistent');
${Array.from(Array(30).keys()).map(
i => `INSERT INTO JuxtaStatIndividualStats VALUES(${i + 30}, 99, 101, 0); INSERT INTO JuxtaStatUserDomain VALUES(${i + 30}, 'urbanstats.org');`,
i => `INSERT INTO JuxtaStatIndividualStats VALUES(${i + 30}, 99, 101, 0); INSERT INTO JuxtaStatUserDomain VALUES(${i + 30}, 'testproxy.nonexistent');`,
).join('\n')}`,
platform,
)
Expand All @@ -217,7 +217,7 @@ export function quizTest({ platform }: { platform: 'desktop' | 'mobile' }): void
await t.eval(() => {
localStorage.clear()
localStorage.setItem('persistent_id', '000000000000008')
localStorage.setItem('testHostname', 'urbanstats.org')
localStorage.setItem('testHostname', 'testproxy.nonexistent')
})
await safeReload(t)
await clickButtons(t, ['a', 'a', 'a', 'a', 'a'])
Expand Down
2 changes: 1 addition & 1 deletion react/test/quiz_test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function quizFixture(fixName: string, url: string, newLocalstorage: Recor
}
}, { dependencies: { newLocalstorage } })
await t.eval(() => {
localStorage.setItem('testHostname', 'urbanstats.org')
localStorage.setItem('testHostname', 'testproxy.nonexistent')
})
// Must reload after setting localstorage so page picks it up
await safeReload(t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def get_per_question_stats_from_table(day, table_name, column):
INNER JOIN JuxtastatUserDomain
ON {table_name}.user = JuxtastatUserDomain.user
WHERE {column} = ?
AND domain = 'urbanstats.org'
AND (domain = 'urbanstats.org' OR domain = 'testproxy.nonexistent')
""",
(day,),
)
Expand Down

0 comments on commit 9dd849a

Please sign in to comment.