sadpandajoe commented on code in PR #39534:
URL: https://github.com/apache/superset/pull/39534#discussion_r3198109179


##########
superset-frontend/playwright/tests/sqllab/saved-queries.spec.ts:
##########


Review Comment:
   We should probably also convert this to a unit test in 
`superset-frontend/src/utils/pathUtils.test.ts`
   
   ```
   test('ensureAppRoot should be idempotent — not double-prefix an 
already-prefixed path', async () => {
     jest.resetModules();
     document.getElementById('app')?.setAttribute(
       'data-bootstrap',
       JSON.stringify({ common: { conf: { APP_ROOT: '/superset/' } } }),
     );
     const { ensureAppRoot } = await import('./pathUtils');
   
     const once = ensureAppRoot('/sqllab');
     const twice = ensureAppRoot(once);
     expect(twice).toBe(once); // /superset/sqllab, NOT 
/superset/superset/sqllab
   });
   
   test('makeUrl should be idempotent with subdirectory prefix', async () => {
     jest.resetModules();
     document.getElementById('app')?.setAttribute(
       'data-bootstrap',
       JSON.stringify({ common: { conf: { APP_ROOT: '/superset/' } } }),
     );
     const { makeUrl } = await import('./pathUtils');
   
     const once = makeUrl('/sqllab?new=true');
     const twice = makeUrl(once);
     expect(twice).toBe(once);
   });
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to