Skip to content

Commit

Permalink
[next] Update app test fixture (#8584)
Browse files Browse the repository at this point in the history
### Related Issues

Updates our test fixture for related changes in latest canary of
Next.js.

Fixes: https://vercel.slack.com/archives/CGU8HUTUH/p1663607276817069

### 📋 Checklist

<!--
  Please keep your PR as a Draft until the checklist is complete
-->

#### Tests

- [ ] The code changed/added as part of this PR has been covered with
tests
- [ ] All tests pass locally with `yarn test-unit`

#### Code Review

- [ ] This PR has a concise title and thorough description useful to a
reviewer
- [ ] Issue from task tracker has a link to this PR
  • Loading branch information
ijjk committed Sep 19, 2022
1 parent 20e8fdd commit 1f30e3a
Show file tree
Hide file tree
Showing 41 changed files with 114 additions and 168 deletions.
10 changes: 10 additions & 0 deletions packages/next/test/fixtures/00-app-dir/app/(newroot)/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default function Root({ children }) {
return (
<html className="this-is-another-document-html">
<head>
<title>{`hello world`}</title>
</head>
<body className="this-is-another-document-body">{children}</body>
</html>
);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'client';

import { useState, useEffect } from 'react';

import style from './style.module.css';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'client';

import { useState, useEffect } from 'react';

import styles from './style.module.css';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
export async function getServerSideProps({ params }) {
return {
props: {
id: params.id,
},
};
}

export default function DeploymentsPage(props) {
return (
<>
<p>hello from app/dashboard/deployments/[id]. ID is: {props.id}</p>
<p>hello from app/dashboard/deployments/[id]. ID is: {props.params.id}</p>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default function DeploymentsLayout({ message, children }) {
return (
<>
<h2>Deployments hello</h2>
{children}
</>
);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'client';

export default function LazyComponent() {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClientComponent } from './test.client.js';
import { ClientComponent } from './test.js';

export default function DashboardIndexPage() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'client';

import { useState, lazy } from 'react';

const Lazy = lazy(() => import('./lazy.client.js'));
const Lazy = lazy(() => import('./lazy.js'));

export function ClientComponent() {
let [state] = useState('client');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
export async function getServerSideProps({ params }) {
return {
props: {
params,
},
};
}

export default function IdLayout({ children, params }) {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
export async function getServerSideProps({ params }) {
return {
props: {
params,
},
};
}

export default function IdPage({ children, params }) {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
export async function getServerSideProps({ params }) {
return {
props: {
params,
},
};
}

export default function CategoryLayout({ children, params }) {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
export async function getServerSideProps({ params }) {
return {
props: {
params,
},
};
}

export default function DynamicLayout({ children, params }) {
return (
<>
Expand Down
14 changes: 14 additions & 0 deletions packages/next/test/fixtures/00-app-dir/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default function Root({ children }) {
return (
<html className="this-is-the-document-html">
<head>
<title>{`hello world`}</title>
</head>
<body className="this-is-the-document-body">{children}</body>
</html>
);
}

export const config = {
revalidate: 0,
};
18 changes: 0 additions & 18 deletions packages/next/test/fixtures/00-app-dir/app/layout.server.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function DeploymentsPage(props) {
return (
<>
<p>hello from app/partial-match-[id]. ID is: {props.params.id}</p>
</>
);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'client';

export default function ShouldNotServeClientDotJs(props) {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { experimental_use as use } from 'react';

async function getData() {
await new Promise(resolve => setTimeout(resolve, 1000));
return {
message: 'hello from slow layout',
};
}

export default function SlowLayout(props) {
const data = use(getData());
return (
<>
<p id="slow-layout-message">{data.message}</p>
{props.children}
</>
);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { experimental_use as use } from 'react';

async function getData() {
await new Promise(resolve => setTimeout(resolve, 5000));
return {
message: 'hello from slow page',
};
}

export default function SlowPage(props) {
const data = use(getData());
return <h1 id="slow-page-message">{data.message}</h1>;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { experimental_use as use } from 'react';

async function getData() {
await new Promise(resolve => setTimeout(resolve, 5000));
return {
message: 'hello from slow layout',
};
}

export default function SlowLayout(props) {
const data = use(getData());
return (
<>
<p id="slow-layout-message">{data.message}</p>
{props.children}
</>
);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { experimental_use as use } from 'react';

async function getData() {
await new Promise(resolve => setTimeout(resolve, 5000));
return {
message: 'hello from slow page',
};
}

export default function SlowPage(props) {
const data = use(getData());
return <h1 id="slow-page-message">{data.message}</h1>;
}

This file was deleted.

0 comments on commit 1f30e3a

Please sign in to comment.