Skip to content

Commit

Permalink
feat(currentTeamProjectValidation): Formatted code for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvisraymond-uchicago committed Nov 21, 2023
1 parent 750a7da commit 20ebc8e
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,22 @@ const sampleData = {
};

describe('IsCurrentTeamProjectValid', () => {
it('should return false if data doesn\'t contain teams', () => {
// Call the function with sample data
it(`should return false if data doesn't contain teams`, () => {
const result = IsCurrentTeamProjectValid({ notTeams: [] });
// Expect the result to be false
expect(result).toBe(false);
});

it('should return false if current team project is not valid', () => {
// Mock localStorage.getItem to return an invalid team project
localStorageMock.getItem.mockReturnValue('InvalidTeamName');

// Call the function with sample data
const result = IsCurrentTeamProjectValid(sampleData);

// Expect the result to be false
expect(result).toBe(false);

// Expect localStorage.getItem to have been called with the correct argument
expect(localStorageMock.getItem).toHaveBeenCalledWith('teamProject');
});

it('should return true if current team project is valid', () => {
localStorageMock.getItem.mockReturnValue('ValidTeamName');
// Call the function with sample data
const result = IsCurrentTeamProjectValid(sampleData);
// Expect the result to be true
expect(result).toBe(true);
// Expect localStorage.getItem to have been called with the correct argument
expect(localStorageMock.getItem).toHaveBeenCalledWith('teamProject');
});
});

0 comments on commit 20ebc8e

Please sign in to comment.