| 543 | |
| 544 | describe('reopenNavigationsFor', () => { |
| 545 | const app = (name: string) => ({ |
| 546 | [`apps/${name}/package.json`]: JSON.stringify({ name, dependencies: { react: '18', 'react-router-dom': '6' } }), |
| 547 | [`apps/${name}/src/App.jsx`]: |
| 548 | "import { Routes, Route } from 'react-router-dom'\n" + |
| 549 | "import { Home } from './Home'\n" + |
| 550 | 'export const App = () => (\n <Routes>\n <Route path="/" element={<Home />} />\n </Routes>\n)\n', |
| 551 | // Two calls to routes the app does not have, and one to its `/`. |
| 552 | [`apps/${name}/src/Home.jsx`]: |
| 553 | "import { useNavigate } from 'react-router-dom'\n" + |
| 554 | 'export const Home = () => {\n' + |
| 555 | ' const navigate = useNavigate()\n' + |
| 556 | " const go = () => navigate('/login')\n" + |
| 557 | " const back = () => navigate('/back')\n" + |
| 558 | " const home = () => navigate('/')\n" + |
| 559 | ' return <button onClick={go} onDoubleClick={back} onBlur={home}>Go</button>\n' + |
| 560 | '}\n', |
| 561 | }); |
| 562 | |
| 563 | async function monorepo(): Promise<CodeGraph> { |
| 564 | const root = tempRoot(); |