├── .babelrc ├── .eslintrc.json ├── .gitignore ├── README.md ├── __tests__ ├── __snapshots__ │ └── snapshot.js.snap ├── snapshot.js └── testing-library.js ├── components ├── filter.tsx ├── header.tsx └── jobItem.tsx ├── config └── jest │ └── cssTransform.js ├── declaration.d.ts ├── jest.config.js ├── mock └── jobs.json ├── next-env.d.ts ├── next.config.js ├── package-lock.json ├── package.json ├── pages ├── _app.js └── index.tsx ├── public ├── favicon-32x32.png ├── favicon.ico ├── icon-remove.svg ├── images │ ├── bg-header-desktop.svg │ └── bg-header-mobile.svg ├── logos │ ├── account.svg │ ├── eyecam-co.svg │ ├── faceit.svg │ ├── insure.svg │ ├── loop-studios.svg │ ├── manage.svg │ ├── myhome.svg │ ├── photosnap.svg │ ├── shortly.svg │ └── the-air-filter-company.svg └── zeit.svg ├── setupTests.js ├── styles ├── _mixin.scss ├── _variables.scss ├── global.scss ├── index.scss └── shared.scss ├── tsconfig.json └── types └── types.ts /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["next/babel"] 3 | } 4 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | } 5 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # vercel 34 | .vercel 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Next.js + Jest 2 | 3 | This example shows how to configure Jest to work with Next.js. 4 | 5 | This includes Next.js' built-in support for Global CSS, CSS Modules, and TypeScript! 6 | 7 | ## How to Use 8 | 9 | Quickly get started using [Create Next App](https://github.com/vercel/next.js/tree/canary/packages/create-next-app#readme)! 10 | 11 | In your terminal, run the following command: 12 | 13 | ```bash 14 | npx create-next-app --example with-jest 15 | ``` 16 | 17 | ## Run Jest Tests 18 | 19 | ```bash 20 | npm test 21 | ``` 22 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/snapshot.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`renders homepage unchanged 1`] = ` 4 |
7 |
8 |

11 | Welcome to 12 | 15 | Next.js! 16 | 17 |

18 |

21 | Get started by editing 22 | 23 | pages/index.js 24 | 25 |

26 |
29 | 33 |

34 | Documentation → 35 |

36 |

37 | Find in-depth information about Next.js features and API. 38 |

39 |
40 | 44 |

45 | Learn → 46 |

47 |

48 | Learn about Next.js in an interactive course with quizzes! 49 |

50 |
51 | 55 |

56 | Examples → 57 |

58 |

59 | Discover and deploy boilerplate example Next.js projects. 60 |

61 |
62 | 66 |

67 | Deploy → 68 |

69 |

70 | Instantly deploy your Next.js site to a public URL with Vercel. 71 |

72 |
73 |
74 |
75 |
76 | `; 77 | -------------------------------------------------------------------------------- /__tests__/snapshot.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import renderer from 'react-test-renderer' 3 | import Index from '../pages/index' 4 | 5 | it('renders homepage unchanged', () => { 6 | const tree = renderer.create().toJSON() 7 | expect(tree).toMatchSnapshot() 8 | }) 9 | -------------------------------------------------------------------------------- /__tests__/testing-library.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { render } from '@testing-library/react' 3 | import Index from '../pages/index' 4 | 5 | test('renders deploy link', () => { 6 | const { getByText } = render() 7 | const linkElement = getByText( 8 | /Instantly deploy your Next\.js site to a public URL with Vercel\./ 9 | ) 10 | expect(linkElement).toBeInTheDocument() 11 | }) 12 | -------------------------------------------------------------------------------- /components/filter.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | FC, 3 | } from 'react'; 4 | import 5 | Select, 6 | { components } 7 | from 'react-select'; 8 | import variants from '../styles/_variables.scss'; 9 | 10 | interface FilterProps { 11 | className?: string; 12 | options?: object; 13 | value?: any; 14 | onChange?: any; 15 | } 16 | 17 | const filterStyle = { 18 | control: styles => ({ 19 | ...styles, 20 | backgroundColor: 'white', 21 | minHeight: 65, 22 | marginBottom: 45, 23 | borderRadius: 5, 24 | border: 'none', 25 | boxShadow: '0px 20px 21px #d4e9ec' 26 | }), 27 | valueContainer: (styles) => ({ 28 | ...styles, 29 | padding: '10px 30px' 30 | }), 31 | multiValue: (styles) => ({ 32 | ...styles, 33 | color: variants.green, 34 | backgroundColor: variants.backgroundColor, 35 | margin: '0 7px' 36 | }), 37 | multiValueLabel: (styles, { data }) => ({ 38 | ...styles, 39 | color: variants.green, 40 | fontSize: 14, 41 | fontWeight: 'bold', 42 | padding: '10px 10px', 43 | }), 44 | multiValueRemove: (styles, { data }) => ({ 45 | ...styles, 46 | color: '#fff', 47 | backgroundColor: variants.green, 48 | padding: '5px 10px', 49 | 50 | ':hover': { 51 | backgroundColor: '#000000', 52 | color: 'white', 53 | cursor: 'pointer' 54 | }, 55 | 56 | }), 57 | }; 58 | 59 | const ClearIndicator = props => { 60 | const { 61 | getStyles, 62 | innerProps: { ref, ...restInnerProps }, 63 | } = props; 64 | return ( 65 |
70 | Clear 71 |
72 | ); 73 | }; 74 | 75 | 76 | const Filter: FC = ({ 77 | options, 78 | className, 79 | ...rest 80 | }) => { 81 | return ( 82 |