Skip to content

Commit 68eef62

Browse files
Duckierstone42UZ9
andauthored
Revamp Analytics Tests (#220)
Co-authored-by: Yerti <36551149+UZ9@users.noreply.github.com>
1 parent 3f72e11 commit 68eef62

12 files changed

Lines changed: 397 additions & 226 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ With [OpenAPI](https://docs.nestjs.com/openapi/introduction), much of the intern
123123

124124
We use [Prisma](https://www.prisma.io/) in `db-service` as an ORM to define all database schemas/relationships. After a change has been made to the Prisma schema, a migration must be made. There are two options:
125125

126-
1. While Juno is running, run `DATABASE_URL=postgresql://user:password@localhost:<port> pnpm prisma migrate` to generate the migration
126+
1. While Juno is running, run `DATABASE_URL=postgresql://user:password@localhost:<port> pnpm prisma migrate dev --schema=<path to schema.prisma>` to generate the migration
127127
2. Verify a new migration has been created under the `migrations` folder
128128

129129
### Force rebuilding docker containers

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"start:dev:live-packages": "concurrently -k \"pnpm start:dev:watch-packages\" \"pnpm start:dev:up-packages\"",
1515
"start:dev:live-proto": "concurrently -k \"pnpm start:dev:watch-proto\" \"pnpm start:dev:up-proto\"",
1616
"start:dev:live-all": "concurrently -k -P --success=\"last\" \"pnpm start:dev:watch-all\" \"pnpm start:dev:up-all {@}\" -- ",
17+
"dev": "pnpm start:dev:live-all",
1718
"format:check": "pnpm prettier --check .",
1819
"format:write": "pnpm prettier --write .",
1920
"format": "pnpm prettier --write .",

‎packages/analytics-service/src/bog-analytics.service.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Injectable } from '@nestjs/common';
2+
23
import {
34
AnalyticsViewer,
45
AnalyticsLogger as BogAnalyticsLogger,

‎packages/analytics-service/src/modules/analytics/analytics.service.ts‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class AnalyticsService implements OnModuleInit {
145145
const logger = await this.getAnalyticsLogger(
146146
this.EventEnvironment.DEVELOPMENT,
147147
event.configId,
148-
event.environment,
148+
event.configEnvironment,
149149
);
150150

151151
if (
@@ -194,7 +194,7 @@ export class AnalyticsService implements OnModuleInit {
194194
const logger = await this.getAnalyticsLogger(
195195
this.EventEnvironment.DEVELOPMENT,
196196
event.configId,
197-
event.environment,
197+
event.configEnvironment,
198198
);
199199

200200
if (
@@ -239,7 +239,7 @@ export class AnalyticsService implements OnModuleInit {
239239
const logger = await this.getAnalyticsLogger(
240240
this.EventEnvironment.DEVELOPMENT,
241241
event.configId,
242-
event.environment,
242+
event.configEnvironment,
243243
);
244244

245245
if (
@@ -376,7 +376,7 @@ export class AnalyticsService implements OnModuleInit {
376376
const viewer = await this.getAnalyticsViewer(
377377
this.EventEnvironment.DEVELOPMENT,
378378
request.configId,
379-
request.environment,
379+
request.configEnvironment,
380380
);
381381

382382
if (!request.projectName || request.projectName.length === 0) {
@@ -427,7 +427,6 @@ export class AnalyticsService implements OnModuleInit {
427427
async getAllClickEvents(
428428
request: AnalyticsProto.GetAllClickEventsRequest,
429429
): Promise<AnalyticsProto.GetAllClickEventsResponse> {
430-
console.log('requesting new viewer ');
431430
const viewer = await this.getAnalyticsViewer(
432431
this.EventEnvironment.DEVELOPMENT,
433432
request.configId,
@@ -452,10 +451,7 @@ export class AnalyticsService implements OnModuleInit {
452451
limit,
453452
);
454453

455-
console.log(response);
456-
457454
if (!response) {
458-
console.log('null,');
459455
return { events: [] };
460456
}
461457

@@ -507,7 +503,6 @@ export class AnalyticsService implements OnModuleInit {
507503
};
508504

509505
const response = await viewer.getVisitEventsPaginated(queryParams);
510-
511506
if (!response) {
512507
return { events: [], afterId: '' };
513508
}

0 commit comments

Comments
 (0)