@@ -464,6 +464,59 @@ describe("Tilavaraus ui reservation unit page (single)", () => {
464464 } ) ;
465465 } ) ;
466466
467+ describe ( "with reservation quota notification" , ( ) => {
468+ it ( "should display apt notification if quota is set and full" , ( ) => {
469+ cy . window ( ) . then ( ( ) => {
470+ sessionStorage . setItem (
471+ `oidc.apiToken.${ Cypress . env ( "API_SCOPE" ) } ` ,
472+ "foobar"
473+ ) ;
474+ } ) ;
475+
476+ cy . visit ( "/reservation-unit/single/901" ) ;
477+
478+ gotoCalendarButton ( ) . should ( "exist" ) ;
479+
480+ calendarWrapper ( ) . should ( "exist" ) ;
481+
482+ reservationSubmitButton ( ) . should ( "not.exist" ) ;
483+
484+ reservationQuotaNotification ( )
485+ . invoke ( "text" )
486+ . should (
487+ "match" ,
488+ / ^ S i n u l l a o n j o \d + v a r a u s t a t ä h ä n t i l a a n . E t v o i t e h d ä u u s i a v a r a u k s i a .$ /
489+ ) ;
490+
491+ cy . window ( ) . then ( ( ) => {
492+ sessionStorage . removeItem ( `oidc.apiToken.${ Cypress . env ( "API_SCOPE" ) } ` ) ;
493+ } ) ;
494+ } ) ;
495+
496+ it ( "should display apt notification if quota is set but not full" , ( ) => {
497+ cy . window ( ) . then ( ( ) => {
498+ sessionStorage . setItem (
499+ `oidc.apiToken.${ Cypress . env ( "API_SCOPE" ) } ` ,
500+ "foobar"
501+ ) ;
502+ } ) ;
503+
504+ cy . visit ( "/reservation-unit/single/902" ) ;
505+
506+ gotoCalendarButton ( ) . should ( "exist" ) ;
507+
508+ calendarWrapper ( ) . should ( "exist" ) ;
509+
510+ reservationQuotaNotification ( )
511+ . invoke ( "text" )
512+ . should ( "match" , / ^ S i n u l l a o n j o \d + \/ \d + v a r a u s t a t ä h ä n t i l a a n .$ / ) ;
513+
514+ cy . window ( ) . then ( ( ) => {
515+ sessionStorage . removeItem ( `oidc.apiToken.${ Cypress . env ( "API_SCOPE" ) } ` ) ;
516+ } ) ;
517+ } ) ;
518+ } ) ;
519+
467520 describe ( "with metadataset" , ( ) => {
468521 Cypress . config ( "defaultCommandTimeout" , 20000 ) ;
469522 beforeEach ( ( ) => {
0 commit comments