generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added status on outside of task card, Created a dev feature component (…
…#959) * Added status on outside of task card, Created a dev feature component * Added task maping for NEEDS_REVIEW * Added test for status on task card * Correct the test name * Removed any type * Correct the spelling of test case --------- Co-authored-by: Shubham Sharma <[email protected]> Co-authored-by: Amit Prakash <[email protected]> Co-authored-by: Shubham Kumar Singh <[email protected]>
- Loading branch information
1 parent
6e9f0e5
commit 1846697
Showing
6 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { screen } from '@testing-library/react'; | ||
import DevFeature from '@/components/DevFeature'; | ||
|
||
import { renderWithRouter } from '@/test_utils/createMockRouter'; | ||
|
||
describe('DevFeature', () => { | ||
it('Should not render anything when there is no dev flag', () => { | ||
renderWithRouter( | ||
<DevFeature> | ||
<p>Children</p> | ||
</DevFeature> | ||
); | ||
|
||
expect(screen.queryByText('Children')).not.toBeInTheDocument(); | ||
}); | ||
it('Should render children when dev=true', () => { | ||
renderWithRouter( | ||
<DevFeature> | ||
<p>Children</p> | ||
</DevFeature>, | ||
{ | ||
query: { dev: 'true' }, | ||
} | ||
); | ||
|
||
expect(screen.queryByText('Children')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { useRouter } from 'next/router'; | ||
type props = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export default function DevFeature({ children }: props) { | ||
const router = useRouter(); | ||
const { dev } = router.query; | ||
if (dev !== 'true') { | ||
return <></>; | ||
} | ||
return <>{children}</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters