Skip to content

Commit

Permalink
Test for isDeepLink
Browse files Browse the repository at this point in the history
Signed-off-by: Alex H <ahiguera@Alexs-MacBook-Pro.local>
  • Loading branch information
Alex H authored and Alex H committed Jan 17, 2025
1 parent 5848255 commit 636d2f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions test/decode.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { isDeepLink } from '../app/lib/decode';

jest.mock('../app/lib/decode', () => ({
isDeepLink: jest.fn(),
}));

describe('isDeepLink', () => {
it('returns true if deep link starts with correct scheme', () => {
//use sample text
const text = 'https://lcw.app/request.html?issuer=issuer.example.com&auth_type=bearer&challenge=4adfe67b-58b3-45d0-8043-cc3f11f75513&vc_request_url=https://dashboard.dcconsortium.org/api/exchange/d7ff30bd-cc7c-4500-92b8-d17f2de33d32/4adfe67b-58b3-45d0-8043-cc3f11f75513/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ODk2ZjNkNjYyMDNmM2Q5Zjk3YzYyNiIsImlhdCI6MTczNzA2MDE5MSwiZXhwIjoxNzM4MjY5NzkxfQ.f_UnlImw-KJeDuHZXs9vxGNVbo9NQZaDjTXwJhZ12aU';

(isDeepLink as jest.Mock).mockReturnValue(true);

const result = isDeepLink(text);
expect(result).toBe(true);
});
});
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"compilerOptions": {
"jsx": "react",
"strict": true
}
},
"types": ["jest", "node"]
}

0 comments on commit 636d2f2

Please sign in to comment.