@@ -51,15 +51,13 @@ const mockAppSettings: AppSettings = {
5151describe ( "browsertrix-app" , ( ) => {
5252 beforeEach ( ( ) => {
5353 AppStateService . resetAll ( ) ;
54- AuthService . broadcastChannel = new BroadcastChannel ( AuthService . storageKey ) ;
5554 window . sessionStorage . clear ( ) ;
5655 window . localStorage . clear ( ) ;
5756 stub ( window . history , "pushState" ) ;
5857 stub ( NotifyController . prototype , "toast" ) ;
5958 } ) ;
6059
6160 afterEach ( ( ) => {
62- AuthService . broadcastChannel . close ( ) ;
6361 restore ( ) ;
6462 } ) ;
6563
@@ -69,7 +67,7 @@ describe("browsertrix-app", () => {
6967 } ) ;
7068
7169 it ( "don't block render if settings aren't defined" , async ( ) => {
72- stub ( AuthService , "initSessionStorage" ) . returns (
70+ stub ( AuthService . prototype , "initSessionStorage" ) . returns (
7371 Promise . resolve ( {
7472 headers : { Authorization : "_fake_headers_" } ,
7573 tokenExpiresAt : 0 ,
@@ -85,7 +83,7 @@ describe("browsertrix-app", () => {
8583 } ) ;
8684
8785 it ( "renders 404 when not in org" , async ( ) => {
88- stub ( AuthService , "initSessionStorage" ) . returns (
86+ stub ( AuthService . prototype , "initSessionStorage" ) . returns (
8987 Promise . resolve ( {
9088 headers : { Authorization : "_fake_headers_" } ,
9189 tokenExpiresAt : 0 ,
@@ -117,7 +115,7 @@ describe("browsertrix-app", () => {
117115 role : 10 ,
118116 } ;
119117
120- stub ( AuthService , "initSessionStorage" ) . returns (
118+ stub ( AuthService . prototype , "initSessionStorage" ) . returns (
121119 Promise . resolve ( {
122120 headers : { Authorization : "_fake_headers_" } ,
123121 tokenExpiresAt : 0 ,
@@ -142,7 +140,9 @@ describe("browsertrix-app", () => {
142140 } ) ;
143141
144142 it ( "renders log in when not authenticated" , async ( ) => {
145- stub ( AuthService , "initSessionStorage" ) . returns ( Promise . resolve ( null ) ) ;
143+ stub ( AuthService . prototype , "initSessionStorage" ) . returns (
144+ Promise . resolve ( null ) ,
145+ ) ;
146146 // @ts -expect-error checkFreshness is private
147147 stub ( AuthService . prototype , "checkFreshness" ) ;
148148 stub ( NavigateController , "createNavigateEvent" ) . callsFake (
@@ -184,7 +184,7 @@ describe("browsertrix-app", () => {
184184 Promise . resolve ( mockAPIUser ) ,
185185 ) ;
186186 stub ( AuthService . prototype , "startFreshnessCheck" ) . callsFake ( ( ) => { } ) ;
187- stub ( AuthService , "initSessionStorage" ) . callsFake ( async ( ) =>
187+ stub ( AuthService . prototype , "initSessionStorage" ) . callsFake ( async ( ) =>
188188 Promise . resolve ( {
189189 headers : { Authorization : "_fake_headers_" } ,
190190 tokenExpiresAt : 0 ,
@@ -203,7 +203,7 @@ describe("browsertrix-app", () => {
203203 Promise . resolve ( mockAPIUser ) ,
204204 ) ;
205205 stub ( AuthService . prototype , "startFreshnessCheck" ) . callsFake ( ( ) => { } ) ;
206- stub ( AuthService , "initSessionStorage" ) . callsFake ( async ( ) =>
206+ stub ( AuthService . prototype , "initSessionStorage" ) . callsFake ( async ( ) =>
207207 Promise . resolve ( {
208208 headers : { Authorization : "_fake_headers_" } ,
209209 tokenExpiresAt : 0 ,
@@ -235,7 +235,7 @@ describe("browsertrix-app", () => {
235235 ) ;
236236 stub ( App . prototype , "getLocationPathname" ) . callsFake ( ( ) => `/orgs/${ id } ` ) ;
237237 stub ( AuthService . prototype , "startFreshnessCheck" ) . callsFake ( ( ) => { } ) ;
238- stub ( AuthService , "initSessionStorage" ) . callsFake ( async ( ) =>
238+ stub ( AuthService . prototype , "initSessionStorage" ) . callsFake ( async ( ) =>
239239 Promise . resolve ( {
240240 headers : { Authorization : "_fake_headers_" } ,
241241 tokenExpiresAt : 0 ,
0 commit comments