@@ -684,11 +684,11 @@ describe("OAuth Authorization", () => {
684
684
expect ( body . get ( "grant_type" ) ) . toBe ( "authorization_code" ) ;
685
685
expect ( body . get ( "code" ) ) . toBe ( "code123" ) ;
686
686
expect ( body . get ( "code_verifier" ) ) . toBe ( "verifier123" ) ;
687
- expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
687
+ expect ( body . get ( "client_id" ) ) . toBeNull ( ) ;
688
688
expect ( body . get ( "redirect_uri" ) ) . toBe ( "http://localhost:3000/callback" ) ;
689
689
expect ( body . get ( "example_url" ) ) . toBe ( "https://auth.example.com/token" ) ;
690
690
expect ( body . get ( "example_param" ) ) . toBe ( "example_value" ) ;
691
- expect ( body . get ( "client_secret" ) ) . toBeUndefined ;
691
+ expect ( body . get ( "client_secret" ) ) . toBeNull ( ) ;
692
692
} ) ;
693
693
694
694
it ( "validates token response schema" , async ( ) => {
@@ -829,10 +829,10 @@ describe("OAuth Authorization", () => {
829
829
const body = mockFetch . mock . calls [ 0 ] [ 1 ] . body as URLSearchParams ;
830
830
expect ( body . get ( "grant_type" ) ) . toBe ( "refresh_token" ) ;
831
831
expect ( body . get ( "refresh_token" ) ) . toBe ( "refresh123" ) ;
832
- expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
832
+ expect ( body . get ( "client_id" ) ) . toBeNull ( ) ;
833
833
expect ( body . get ( "example_url" ) ) . toBe ( "https://auth.example.com/token" ) ;
834
834
expect ( body . get ( "example_param" ) ) . toBe ( "example_value" ) ;
835
- expect ( body . get ( "client_secret" ) ) . toBeUndefined ;
835
+ expect ( body . get ( "client_secret" ) ) . toBeNull ( ) ;
836
836
} ) ;
837
837
838
838
it ( "exchanges refresh token for new tokens and keep existing refresh token if none is returned" , async ( ) => {
@@ -1632,7 +1632,7 @@ describe("OAuth Authorization", () => {
1632
1632
const request = mockFetch . mock . calls [ 0 ] [ 1 ] ;
1633
1633
1634
1634
// Check Authorization header
1635
- const authHeader = request . headers [ "Authorization" ] ;
1635
+ const authHeader = request . headers . get ( "Authorization" ) ;
1636
1636
const expected = "Basic " + btoa ( "client123:secret123" ) ;
1637
1637
expect ( authHeader ) . toBe ( expected ) ;
1638
1638
@@ -1660,7 +1660,7 @@ describe("OAuth Authorization", () => {
1660
1660
const request = mockFetch . mock . calls [ 0 ] [ 1 ] ;
1661
1661
1662
1662
// Check no Authorization header
1663
- expect ( request . headers [ "Authorization" ] ) . toBeUndefined ( ) ;
1663
+ expect ( request . headers . get ( "Authorization" ) ) . toBeNull ( ) ;
1664
1664
1665
1665
const body = request . body as URLSearchParams ;
1666
1666
expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
@@ -1692,7 +1692,7 @@ describe("OAuth Authorization", () => {
1692
1692
const request = mockFetch . mock . calls [ 0 ] [ 1 ] ;
1693
1693
1694
1694
// Check no Authorization header
1695
- expect ( request . headers [ "Authorization" ] ) . toBeUndefined ( ) ;
1695
+ expect ( request . headers . get ( "Authorization" ) ) . toBeNull ( ) ;
1696
1696
1697
1697
const body = request . body as URLSearchParams ;
1698
1698
expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
@@ -1717,7 +1717,7 @@ describe("OAuth Authorization", () => {
1717
1717
const request = mockFetch . mock . calls [ 0 ] [ 1 ] ;
1718
1718
1719
1719
// Check no Authorization header
1720
- expect ( request . headers [ "Authorization" ] ) . toBeUndefined ( ) ;
1720
+ expect ( request . headers . get ( "Authorization" ) ) . toBeNull ( ) ;
1721
1721
1722
1722
const body = request . body as URLSearchParams ;
1723
1723
expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
@@ -1770,7 +1770,7 @@ describe("OAuth Authorization", () => {
1770
1770
const request = mockFetch . mock . calls [ 0 ] [ 1 ] ;
1771
1771
1772
1772
// Check Authorization header
1773
- const authHeader = request . headers [ "Authorization" ] ;
1773
+ const authHeader = request . headers . get ( "Authorization" ) ;
1774
1774
const expected = "Basic " + btoa ( "client123:secret123" ) ;
1775
1775
expect ( authHeader ) . toBe ( expected ) ;
1776
1776
@@ -1797,7 +1797,7 @@ describe("OAuth Authorization", () => {
1797
1797
const request = mockFetch . mock . calls [ 0 ] [ 1 ] ;
1798
1798
1799
1799
// Check no Authorization header
1800
- expect ( request . headers [ "Authorization" ] ) . toBeUndefined ( ) ;
1800
+ expect ( request . headers . get ( "Authorization" ) ) . toBeNull ( ) ;
1801
1801
1802
1802
const body = request . body as URLSearchParams ;
1803
1803
expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
0 commit comments