@@ -4,11 +4,13 @@ import Client, { createActivity, createActivityComment, getVerificationCode, pin
44import { createMockedSessions } from "./controllers/createMockedSessions" ;
55import createMockedComment from "./controllers/createMockedComment" ;
66
7+ import { name , version } from "./../package.json" ;
8+
79const persons = JSON . parse ( fs . readFileSync ( "./tests/data/persons.json" , "utf-8" ) ) ;
810
911describe ( "Expect active services" , ( ) => {
1012 test ( "Service API" , async ( ) => {
11- const client = new Client ( process . env . VITEST_SERVICE_API_URL , process . env . VITEST_SERVICE_API_TOKEN ) ;
13+ const client = new Client ( ` ${ name } - ${ version } ` , process . env . VITEST_SERVICE_API_URL , process . env . VITEST_SERVICE_API_TOKEN ) ;
1214
1315 const pingResult = await ping ( client ) ;
1416 expect ( pingResult . success ) . toBe ( true ) ;
@@ -22,7 +24,7 @@ describe("Populate mock data", async () => {
2224 let activityComments : string [ ] = [ ] ;
2325
2426 test ( "Create users" , async ( ) => {
25- const client = new Client ( process . env . VITEST_SERVICE_API_URL , process . env . VITEST_SERVICE_API_TOKEN ) ;
27+ const client = new Client ( ` ${ name } - ${ version } ` , process . env . VITEST_SERVICE_API_URL , process . env . VITEST_SERVICE_API_TOKEN ) ;
2628
2729 for ( let index = 0 ; index < 5 ; index ++ ) {
2830 const firstname = persons . names [ Math . floor ( Math . random ( ) * persons . names . length ) ] . split ( ' ' ) [ 0 ] ;
@@ -47,7 +49,7 @@ describe("Populate mock data", async () => {
4749 expect ( tokens . length ) . toBeTruthy ( ) ;
4850
4951 for ( let token of tokens ) {
50- const client = new Client ( process . env . VITEST_SERVICE_API_URL , token ) ;
52+ const client = new Client ( ` ${ name } - ${ version } ` , process . env . VITEST_SERVICE_API_URL , token ) ;
5153
5254 const response = await fetch ( "https://staging.avatar-service.ridetracker.app/api/avatars/render/random" , {
5355 method : "GET" ,
@@ -73,7 +75,7 @@ describe("Populate mock data", async () => {
7375 for ( let index = 0 ; index < 10 ; index ++ ) {
7476 const token = tokens [ Math . floor ( Math . random ( ) * tokens . length ) ] ;
7577
76- const client = new Client ( process . env . VITEST_SERVICE_API_URL , token ) ;
78+ const client = new Client ( ` ${ name } - ${ version } ` , process . env . VITEST_SERVICE_API_URL , token ) ;
7779
7880 const sessions = await createMockedSessions ( ) ;
7981 expect ( sessions ) . toBeTruthy ( ) ;
@@ -92,7 +94,7 @@ describe("Populate mock data", async () => {
9294 for ( let index = 0 ; index < Math . max ( 1 , Math . ceil ( Math . random ( ) * 3 ) ) ; index ++ ) {
9395 const token = tokens [ Math . floor ( Math . random ( ) * tokens . length ) ] ;
9496
95- const client = new Client ( process . env . VITEST_SERVICE_API_URL , token ) ;
97+ const client = new Client ( ` ${ name } - ${ version } ` , process . env . VITEST_SERVICE_API_URL , token ) ;
9698
9799 const activityCommentResult = await createActivityComment ( client , activity , createMockedComment ( ) ) ;
98100 expect ( activityCommentResult . success ) . toBe ( true ) ;
@@ -108,7 +110,7 @@ describe("Populate mock data", async () => {
108110 for ( let index = 0 ; index < 10 ; index ++ ) {
109111 const token = tokens [ Math . floor ( Math . random ( ) * tokens . length ) ] ;
110112
111- const client = new Client ( process . env . VITEST_SERVICE_API_URL , token ) ;
113+ const client = new Client ( ` ${ name } - ${ version } ` , process . env . VITEST_SERVICE_API_URL , token ) ;
112114
113115 const activity = activities [ Math . floor ( Math . random ( ) * activities . length ) ] ;
114116 const parent = activityComments [ Math . floor ( Math . random ( ) * activityComments . length ) ] ;
0 commit comments