Skip to content

Commit

Permalink
webtest
Browse files Browse the repository at this point in the history
  • Loading branch information
revmischa committed Jul 2, 2024
1 parent f883939 commit 45d2a49
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
17 changes: 10 additions & 7 deletions web/app/ui/LoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { auth } from '@/auth';
import { authenticate, unauthenticate } from '../actions';
'use client'

import { auth } from '@/auth'
import { authenticate, unauthenticate } from '../actions'
import { useSession } from 'next-auth/react'

interface Props {
className?: string;
className?: string
}

export const Authentication = async ({ className }: Props) => {
const session = await auth();
export const Authentication = ({ className }: Props) => {
const { data: session } = useSession()

return (
<div className={className}>
Expand All @@ -22,5 +25,5 @@ export const Authentication = async ({ className }: Props) => {
</form>
)}
</div>
);
};
)
}
23 changes: 14 additions & 9 deletions web/lib/component/home/Home.test.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { render, screen } from '@testing-library/react';
import Home from './Home';
import { render, screen } from '@testing-library/react'
import Home from './Home'
import { SessionProvider } from 'next-auth/react'

const DEFAULT_PROPS = {};
const DEFAULT_PROPS = {}

const createComponent = () => {
render(<Home {...DEFAULT_PROPS} />);
};
render(
<SessionProvider>
<Home {...DEFAULT_PROPS} />
</SessionProvider>,
)
}

describe('Home', () => {
it('should able to render component', () => {
createComponent();
expect(screen.getByText('Next+SST')).toBeTruthy();
});
});
createComponent()
expect(screen.getByText('SST Template')).toBeTruthy()
})
})

0 comments on commit 45d2a49

Please sign in to comment.