File tree Expand file tree Collapse file tree 2 files changed +3
-20
lines changed
Expand file tree Collapse file tree 2 files changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -69,18 +69,17 @@ describe("Connection Options", () => {
6969 expect ( result ) . toContain ( "appName=TestApp--test-device-id--unknown" ) ;
7070 } ) ;
7171
72- it ( "should use deviceId utility when deviceId is not provided" , async ( ) => {
72+ it ( "should use deviceId as unknown when deviceId is not provided" , async ( ) => {
7373 const connectionString = "mongodb://localhost:27017" ;
7474 const result = await setAppNameParamIfMissing ( {
7575 connectionString,
7676 components : {
7777 appName : "TestApp" ,
7878 clientName : "TestClient" ,
79- deviceId : DeviceIdService . getInstance ( ) . getDeviceId ( ) ,
8079 } ,
8180 } ) ;
8281
83- expect ( result ) . toContain ( "appName=TestApp--test-device-id --TestClient" ) ;
82+ expect ( result ) . toContain ( "appName=TestApp--unknown --TestClient" ) ;
8483 } ) ;
8584
8685 it ( "should preserve other query parameters" , async ( ) => {
Original file line number Diff line number Diff line change @@ -72,23 +72,6 @@ describe("Device ID Helper", () => {
7272 expect ( MockGetDeviceId ) . toHaveBeenCalledTimes ( 1 ) ; // Still only called once
7373 } ) ;
7474
75- it ( "should return cached device ID without triggering calculation" , async ( ) => {
76- const mockDeviceId = "test-device-id-123" ;
77- MockGetDeviceId . mockResolvedValue ( mockDeviceId ) ;
78-
79- // Initialize after mocking
80- DeviceIdService . init ( testLogger ) ;
81-
82- const deviceId = DeviceIdService . getInstance ( ) ;
83-
84- // First call to populate cache
85- await deviceId . getDeviceId ( ) ;
86-
87- // Get cached value without triggering calculation
88- const cachedValue = await deviceId . getDeviceId ( ) ;
89- expect ( cachedValue ) . toBe ( mockDeviceId ) ;
90- } ) ;
91-
9275 it ( "should allow aborting calculation" , async ( ) => {
9376 MockGetDeviceId . mockImplementation ( ( options ) => {
9477 // Simulate a long-running operation that can be aborted
@@ -145,6 +128,7 @@ describe("Device ID Helper", () => {
145128 const result = await deviceId . getDeviceId ( ) ;
146129
147130 expect ( result ) . toBe ( "device-id" ) ;
131+ expect ( MockGetDeviceId ) . toHaveBeenCalledTimes ( 1 ) ;
148132 } ) ;
149133
150134 it ( "should handle timeout error callback" , async ( ) => {
You can’t perform that action at this time.
0 commit comments