Skip to content

Commit

Permalink
Updates unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeramysoucy committed Oct 30, 2024
1 parent 0abc48b commit 7e23518
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,25 @@ describe('createSessionExpirationToast', () => {
});

describe('SessionExpirationToast', () => {
it('renders session expiration time', () => {
it('renders session expiration time in minutes when >= 60s remaining', () => {
const sessionState$ = of<SessionState>({
lastExtensionTime: Date.now(),
expiresInMs: 60 * 1000,
expiresInMs: 60 * 2000,
canBeExtended: true,
});

const { getByText } = render(
<I18nProvider>
<SessionExpirationToast sessionState$={sessionState$} onExtend={jest.fn()} />
</I18nProvider>
);
getByText(/You will be logged out in [0-9]+ minutes/);
});

it('renders session expiration time in seconds when < 60s remaining', () => {
const sessionState$ = of<SessionState>({
lastExtensionTime: Date.now(),
expiresInMs: 60 * 900,
canBeExtended: true,
});

Expand Down

0 comments on commit 7e23518

Please sign in to comment.