1- import { DiscoveryService } from './discovery.service' ;
1+ import { DiscoveryService } from './discovery.service.js ' ;
22import { HttpService } from '@nestjs/axios' ;
33import { Test , TestingModule } from '@nestjs/testing' ;
44import { AxiosError } from 'axios' ;
@@ -52,11 +52,11 @@ describe('DiscoveryService', () => {
5252 'example.com/authorization_endpoint' ,
5353 ) ;
5454 expect ( oidc . token_endpoint ) . toEqual ( 'example.com/token_endpoint' ) ;
55- expect ( service [ 'oidcResultPerIdp ' ] [ 'APP' ] ) . toEqual ( {
55+ expect ( service [ 'oidcResultPerUrl ' ] [ 'APP' ] ) . toEqual ( {
5656 authorization_endpoint : 'example.com/authorization_endpoint' ,
5757 token_endpoint : 'example.com/token_endpoint' ,
5858 } ) ;
59- expect ( service [ 'oidcResultPerIdp ' ] [ 'APP2' ] ) . toBeUndefined ( ) ;
59+ expect ( service [ 'oidcResultPerUrl ' ] [ 'APP2' ] ) . toBeUndefined ( ) ;
6060 } ) ;
6161
6262 it ( 'should not get oauthServerUrl and oauthTokenUrl and throw error when httpService returns error' , async ( ) => {
@@ -89,13 +89,13 @@ describe('DiscoveryService', () => {
8989
9090 process . env [ 'DISCOVERY_ENDPOINT_APP' ] = 'example.com' ;
9191
92- await expect ( service . getOIDC ( 'APP ' ) ) . rejects . toThrow (
92+ await expect ( service . getOIDC ( 'example.com ' ) ) . rejects . toThrow (
9393 'Invalid response from discovery service: Response status: 101, OIDC endpoint: example.com' ,
9494 ) ;
9595 } ) ;
9696
9797 it ( 'should get null when DISCOVERY_ENDPOINT does not exist' , async ( ) => {
98- const oidc = await service . getOIDC ( 'APP ' ) ;
98+ const oidc = await service . getOIDC ( '' ) ;
9999
100100 expect ( oidc ) . toBeNull ( ) ;
101101 } ) ;
@@ -116,7 +116,7 @@ describe('DiscoveryService', () => {
116116
117117 process . env [ 'DISCOVERY_ENDPOINT_APP' ] = 'example.com' ;
118118
119- await expect ( service . getOIDC ( 'APP ' ) ) . rejects . toThrow (
119+ await expect ( service . getOIDC ( 'example.com ' ) ) . rejects . toThrow (
120120 'Invalid response from discovery service: Response status: 200, OIDC endpoint: example.com' ,
121121 ) ;
122122 } ) ;
@@ -138,10 +138,10 @@ describe('DiscoveryService', () => {
138138
139139 process . env [ 'DISCOVERY_ENDPOINT_APP' ] = 'example.com' ;
140140
141- await expect ( service . getOIDC ( 'APP ' ) ) . rejects . toThrow (
141+ await expect ( service . getOIDC ( 'example.com ' ) ) . rejects . toThrow (
142142 'Invalid response from discovery service: Response status: 200, OIDC endpoint: example.com' ,
143143 ) ;
144- expect ( service [ 'oidcResultPerIdp ' ] [ 'APP ' ] ) . toBeUndefined ( ) ;
144+ expect ( service [ 'oidcResultPerUrl ' ] [ 'example.com ' ] ) . toBeUndefined ( ) ;
145145 } ) ;
146146 } ) ;
147147} ) ;
0 commit comments