Skip to content

Commit

Permalink
Switched to new column name for measurement count
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickNercessian committed May 12, 2024
1 parent d0ce20e commit 6cec80e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/platform-routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ describe('Platform Routes HTTP request handler', () => {
describe('GET /stations/daily', () => {
it('returns daily station metrics for the given date range', async () => {
await givenDailyStationMetrics(pgPool, '2024-01-10', [
{ station_id: 'station1', honest_measurement_count: 1 }
{ station_id: 'station1', accepted_measurement_count: 1 }
])
await givenDailyStationMetrics(pgPool, '2024-01-11', [
{ station_id: 'station2', honest_measurement_count: 1 }
{ station_id: 'station2', accepted_measurement_count: 1 }
])
await givenDailyStationMetrics(pgPool, '2024-01-12', [
{ station_id: 'station2', honest_measurement_count: 2 },
{ station_id: 'station3', honest_measurement_count: 1 }
{ station_id: 'station2', accepted_measurement_count: 2 },
{ station_id: 'station3', accepted_measurement_count: 1 }
])
await givenDailyStationMetrics(pgPool, '2024-01-13', [
{ station_id: 'station1', honest_measurement_count: 1 }
{ station_id: 'station1', accepted_measurement_count: 1 }
])

const res = await fetch(
Expand Down Expand Up @@ -111,12 +111,12 @@ describe('Platform Routes HTTP request handler', () => {

const givenDailyStationMetrics = async (pgPool, day, stationStats) => {
await pgPool.query(`
INSERT INTO daily_stations (day, station_id, honest_measurement_count)
SELECT $1 AS day, UNNEST($2::text[]) AS station_id, UNNEST($3::int[]) AS honest_measurement_count
INSERT INTO daily_stations (day, station_id, accepted_measurement_count)
SELECT $1 AS day, UNNEST($2::text[]) AS station_id, UNNEST($3::int[]) AS accepted_measurement_count
ON CONFLICT DO NOTHING
`, [
day,
stationStats.map(s => s.station_id),
stationStats.map(s => s.honest_measurement_count)
stationStats.map(s => s.accepted_measurement_count)
])
}

0 comments on commit 6cec80e

Please sign in to comment.