Skip to content

Commit

Permalink
chore: removed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Oct 2, 2024
1 parent 482dbb0 commit a7ce912
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions test/helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('Utils', () => {
it('should return true if the token is valid and not expired', () => {
const mockToken = 'mockToken';
const mockDecodedToken = {
exp: mockCurrentTime + 3600, // Token expires in 1 hour
exp: mockCurrentTime + 3600,
};

(jwt.decode as jest.Mock).mockReturnValue(mockDecodedToken);
Expand All @@ -200,7 +200,7 @@ describe('Utils', () => {
it('should return false if the token is expired', () => {
const mockToken = 'mockToken';
const mockDecodedToken = {
exp: mockCurrentTime - 100, // Token expired 100 seconds ago
exp: mockCurrentTime - 100,
};

(jwt.decode as jest.Mock).mockReturnValue(mockDecodedToken);
Expand All @@ -212,15 +212,13 @@ describe('Utils', () => {

it('should return false if the token does not have an exp field', () => {
const mockToken = 'mockToken';
const mockDecodedToken = {
// no 'exp' field
};
const mockDecodedToken = {};

(jwt.decode as jest.Mock).mockReturnValue(mockDecodedToken);

const result = checkJWTTokenExpiration(mockToken);
expect(jwt.decode).toHaveBeenCalledWith(mockToken);
expect(result).toBe(true); // The token is considered valid if no `exp` field
expect(result).toBe(true);
});

it('should return false if jwt.decode returns null', () => {
Expand Down
1 change: 0 additions & 1 deletion test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ describe('validateObjectProperties', () => {
it('should throw an error if validation fails', () => {
const obj = { did: 'invalidDID' };

// Spy on the validateDID method and make it throw an error
jest.spyOn(validationService, 'validateDID').mockImplementation(() => {
throw new Error('Invalid DID');
});
Expand Down

0 comments on commit a7ce912

Please sign in to comment.