Skip to content

Commit

Permalink
cover loginServices.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
aidynoJ committed Feb 5, 2025
1 parent 804e289 commit bf977b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/loginServices.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ describe('validateUser', () => {
it('handles fetch failure from "_self"', async () => {
const store = {
dispatch: jest.fn(),
getState: () => ({ okapi: { tenant: 'monkeyURL' } }),
getState: () => ({ okapi: { tenant: 'monkey', url: 'monkeyUrl' } }),
};

mockFetchError();
Expand All @@ -281,7 +281,7 @@ describe('validateUser', () => {
it('handles valid user with empty tenant in session', async () => {
const store = {
dispatch: jest.fn(),
getState: () => ({ okapi: { tenant: 'monkeyURL' } }),
getState: () => ({ okapi: { tenant: 'monkey', url: 'monkeyUrl', currentPerms: { 'configuration.entries.collection.get': true } } }),
};

const tenant = 'tenant';
Expand Down Expand Up @@ -310,7 +310,7 @@ describe('validateUser', () => {
it('handles valid user with tenant in session', async () => {
const store = {
dispatch: jest.fn(),
getState: () => ({ okapi: { tenant: 'monkeyURL' } }),
getState: () => ({ okapi: { tenant: 'monkey', url: 'monkeyUrl' } }),
};

const tenant = 'tenant';
Expand All @@ -336,7 +336,7 @@ describe('validateUser', () => {
it('overwrites session data with new values from _self', async () => {
const store = {
dispatch: jest.fn(),
getState: () => ({ okapi: { tenant: 'monkeyURL' } }),
getState: () => ({ okapi: { tenant: 'monkey', url: 'monkeyUrl' } }),
};

const tenant = 'tenant';
Expand Down Expand Up @@ -385,7 +385,7 @@ describe('validateUser', () => {
it('handles invalid user', async () => {
const store = {
dispatch: jest.fn(),
getState: () => ({ okapi: { tenant: 'monkey' } }),
getState: () => ({ okapi: { tenant: 'monkey', url: 'monkeyUrl' } }),
};

global.fetch = jest.fn().mockImplementation(() => {
Expand Down

0 comments on commit bf977b0

Please sign in to comment.