| 1 | import { withWebCallback } from './auth.js'; |
| 2 | |
| 3 | describe('withWebCallback', () |
| 4 | const web = |
| 5 | |
| 6 | it('points a relative callback at the web app', |
| 7 | expect( |
| 8 | withWebCallback('http://api.test/api/auth/verify-email?token=t', |
| 9 | ).toBe( |
| 10 | 'http://api.test/api/auth/verify-email?token=t&callbackURL=http%3A%2F%2Flocalhost%3A3000%2F', |
| 11 | ); |
| 12 | }); |
| 13 | |
| 14 | it('keeps an absolute callback the client already chose', |
| 15 | const url = |
| 16 | 'http://api.test/api/auth/reset-password/t?callbackURL=https%3A%2F%2Fapp.test%2Fauth%2Freset-password'; |
| 17 | expect(withWebCallback(url |
| 18 | }); |
| 19 | |
| 20 | it('leaves the url alone when no web app url is configured', |
| 21 | const url = |
| 22 | expect(withWebCallback(url |
| 23 | }); |
| 24 | }); |