Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/ingest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"devDependencies": {
"@cloudflare/workers-types": "5.20260921.1",
"@types/node": "^22",
"drizzle-orm": "^0.45.3",
"typescript": "^5.9.0",
"vitest": "^5.0.3",
"wrangler": "^4.147.0"
Expand Down
23 changes: 10 additions & 13 deletions apps/ingest/test/pipeline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from '@copper/core'
import { PgStore, schema } from '@copper/db'
import { createTestDb } from '@copper/db/testing'
import { eq } from 'drizzle-orm'
import { describe, expect, it } from 'vitest'
import { createApp } from '../src/app'
import { MemoryShardStorage, ShardCore } from '../src/shard-core'
Expand Down Expand Up @@ -103,10 +102,9 @@ describe('one hour of traffic, end to end', () => {

for (const site of SITES) {
const want = expected.get(site.siteKey) as ReturnType<typeof expectedTotals>
const [project] = await db
.select()
.from(schema.project)
.where(eq(schema.project.siteKey, site.siteKey))
const [project] = (await db.select().from(schema.project)).filter(
(p) => p.siteKey === site.siteKey,
)
const id = (project as { id: number }).id
const counters = {
pageviews: want.pageviews,
Expand All @@ -115,17 +113,16 @@ describe('one hour of traffic, end to end', () => {
bounces: want.bounces,
}
expect(
await db.select().from(schema.statsHourly).where(eq(schema.statsHourly.projectId, id)),
(await db.select().from(schema.statsHourly)).filter((r) => r.projectId === id),
).toEqual([{ projectId: id, hour: new Date(T0), ...counters }])
// 03:00 UTC on Oct 5 is still Oct 4 in Los Angeles.
const day = site.timezone === 'UTC' ? '2026-10-05' : '2026-10-04'
expect(
await db.select().from(schema.statsDaily).where(eq(schema.statsDaily.projectId, id)),
).toEqual([{ projectId: id, day, ...counters }])
const [breakdown] = await db
.select()
.from(schema.breakdownDaily)
.where(eq(schema.breakdownDaily.projectId, id))
expect((await db.select().from(schema.statsDaily)).filter((r) => r.projectId === id)).toEqual(
[{ projectId: id, day, ...counters }],
)
const [breakdown] = (await db.select().from(schema.breakdownDaily)).filter(
(r) => r.projectId === id,
)
expect(breakdown?.day).toBe(day)
const pages = breakdown?.data.page ?? {}
expect(Object.fromEntries(Object.entries(pages).map(([p, [pv]]) => [p, pv]))).toEqual(
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading