Skip to content

Commit

Permalink
cleanup e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Oct 2, 2024
1 parent 26ac152 commit 3780eb4
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 571 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use client';
import { useState, useTransition } from 'react';

export function PageComponent({ action }: { action: () => Promise<any> }) {
const [pending, startTransition] = useTransition();
const [res, setRes] = useState(null);

return (
<>
<button
disabled={pending}
onClick={() => {
startTransition(async () => {
await action().then(setRes);
});
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
'use client';
import { useState, useTransition } from 'react';
import { logUserIdActionStack } from '@/app/protect-action/actions';
import { PageComponent } from '@/app/protect-action/page-component';

function Page() {
const [pending, startTransition] = useTransition();
const [res, setRes] = useState(null);

return (
<>
<button
disabled={pending}
onClick={() => {
startTransition(async () => {
await logUserIdActionStack().then(setRes);
});
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent action={logUserIdActionStack} />;
}

export default Page;
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
'use client';
import { useState, useTransition } from 'react';
import { logUserIdActionReverification } from '@/app/protect-action/actions';
import { PageComponent } from '@/app/protect-action/page-component';

function Page() {
const [pending, startTransition] = useTransition();
const [res, setRes] = useState(null);

return (
<>
<button
disabled={pending}
onClick={() => {
startTransition(async () => {
await logUserIdActionReverification().then(setRes);
});
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent action={logUserIdActionReverification} />;
}

export default Page;
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
'use client';
import { useState, useTransition } from 'react';
import { logUserIdActionRole } from '@/app/protect-action/actions';
import { PageComponent } from '@/app/protect-action/page-component';

function Page() {
const [pending, startTransition] = useTransition();
const [res, setRes] = useState(null);

return (
<>
<button
disabled={pending}
onClick={() => {
startTransition(async () => {
await logUserIdActionRole().then(setRes);
});
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent action={logUserIdActionRole} />;
}

export default Page;
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
'use client';
import { useState, useTransition } from 'react';
import { logUserIdAction } from '@/app/protect-action/actions';
import { PageComponent } from '@/app/protect-action/page-component';

function Page() {
const [pending, startTransition] = useTransition();
const [res, setRes] = useState(null);

return (
<>
<button
disabled={pending}
onClick={() => {
startTransition(async () => {
await logUserIdAction().then(setRes);
});
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent action={logUserIdAction} />;
}

export default Page;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useState } from 'react';

export function PageComponent({ url }: { url: string }) {
const [res, setRes] = useState(null);

return (
<>
<button
onClick={async () => {
await fetch(url, {
method: 'POST',
})
.then(res => res.json())
.then(setRes);
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
'use client';
import { useState } from 'react';
import { PageComponent } from '@/app/protect-route/page-component';

function Page() {
const [res, setRes] = useState(null);

return (
<>
<button
onClick={async () => {
await fetch('/api/log-user-id-all', {
method: 'POST',
})
.then(res => res.json())
.then(setRes);
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent url={'/api/log-user-id-all'} />;
}

export default Page;
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
'use client';
import { useState } from 'react';
import { PageComponent } from '@/app/protect-route/page-component';

function Page() {
const [res, setRes] = useState(null);

return (
<>
<button
onClick={async () => {
await fetch('/api/log-user-id-reverification', {
method: 'POST',
})
.then(res => res.json())
.then(setRes);
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent url={'/api/log-user-id-reverification'} />;
}

export default Page;
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
'use client';
import { useState } from 'react';
import { PageComponent } from '@/app/protect-route/page-component';

function Page() {
const [res, setRes] = useState(null);

return (
<>
<button
onClick={async () => {
await fetch('/api/log-user-id-role', {
method: 'POST',
})
.then(res => res.json())
.then(setRes);
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent url={'/api/log-user-id-role'} />;
}

export default Page;
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
'use client';
import { useState } from 'react';
import { PageComponent } from '@/app/protect-route/page-component';

function Page() {
const [res, setRes] = useState(null);

return (
<>
<button
onClick={async () => {
await fetch('/api/log-user-id', {
method: 'POST',
})
.then(res => res.json())
.then(setRes);
}}
>
LogUserId
</button>
<pre>{JSON.stringify(res)}</pre>
</>
);
return <PageComponent url={'/api/log-user-id'} />;
}

export default Page;
Loading

0 comments on commit 3780eb4

Please sign in to comment.