Skip to content

Commit

Permalink
chore: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmilton committed Jan 6, 2022
1 parent c32fc65 commit 922c799
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions test/Router.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ const abcRoutes = [
{ path: '/c', component: () => <>c</> },
];

// Starting from solid v1.1.6, transitions use queueMicrotask so it's now
// necessary to wait a tick before any changes are reflected
// @see https://github.com/solidjs/solid/commit/be5ac4f204871739b2399a50852f454353194841
function routeToAsync(url: string, replace?: boolean) {
return new Promise((resolve) => {
routeTo(url, replace, () => resolve(1));
});
}

afterEach(cleanup);

test('throws without required props', () => {
Expand All @@ -41,7 +32,7 @@ test('renders matching route', async () => {
// function but note that currently there's a global createSignal with a
// location.pathname value which means the signal is created when the file
// is first imported!
await routeToAsync('/c');
await routeTo('/c');
const rendered = render(() => <Router routes={abcRoutes} />);
expect(rendered.container.textContent).toBe('c');
});
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/full/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const routes: Route[] = [
{ path: '/', component: Home },
{
path: '/redirect',
component: () => routeTo('/page1/a/b?c=d#e', true) as JSX.Element,
component: () => routeTo('/page1/a/b?c=d#e', true) as unknown as JSX.Element,
},
];

Expand Down

0 comments on commit 922c799

Please sign in to comment.