feature/ga
Eric 4 years ago
parent 5d0cfb2d20
commit 9ff3e5de60

@ -0,0 +1,13 @@
{
"env": {
"development": {
"presets": ["next/babel"]
},
"production": {
"presets": ["next/babel"]
},
"test": {
"presets": ["@babel/env", "@babel/react"]
}
}
}

@ -0,0 +1,18 @@
import React from 'react'
import { render, screen } from '@testing-library/react'
describe('Index', () => {
it('renders button discover my gift', () => {
const button = screen.getByRole('button', {
name: /Découvrir mon cadeau \.js!/i,
})
expect(button).toBeInTheDocument()
})
it('should test code', () => {
})
})

@ -1,33 +0,0 @@
import React from "react";
import Router from "next/router";
import ReactMarkdown from "react-markdown";
export type PostProps = {
id: number;
title: string;
author: {
name: string;
email: string;
} | null;
content: string;
published: boolean;
};
const Post = ( {post} : {post : PostProps}) => {
const authorName = post.author ? post.author.name : "Unknown author";
return (
<div onClick={() => Router.push("/p/[id]", `/p/${post.id}`)}>
<h2>{post.title}</h2>
<small>By {authorName}</small>
<ReactMarkdown children={post.content} />
<style jsx>{`
div {
color: inherit;
padding: 2rem;
}
`}</style>
</div>
);
};
export default Post;

@ -0,0 +1,20 @@
module.exports = {
collectCoverageFrom: [
'**/*.{js,jsx,ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
],
setupFilesAfterEnv: ['<rootDir>/setupTests.js'],
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': '<rootDir>/node_modules/babel-jest',
'^.+\\.css$': '<rootDir>/config/jest/cssTransform.js',
},
transformIgnorePatterns: [
'/node_modules/',
'^.+\\.module\\.(css|sass|scss)$',
],
moduleNameMapper: {
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
},
}

14813
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -10,7 +10,8 @@
"build": "next build",
"start": "next start",
"db": "npx prisma migrate reset --force",
"test": "playwright test"
"test": "jest --watch",
"test-e2e" : "playwright test"
},
"dependencies": {
"@hookform/resolvers": "^2.9.10",
@ -38,13 +39,22 @@
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@testing-library/dom": "^8.19.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/chance": "^1.1.3",
"@types/jest": "^29.2.4",
"@types/next-auth": "3.13.0",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"babel-jest": "^29.3.1",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"prisma": "^4.6.1",
"supertest": "^6.3.3",
"ts-node": "10.9.1",
"typescript": "4.8.4"
"typescript": "^4.8.4"
},
"prisma": {
"seed": "ts-node prisma/seed.ts"

@ -1,56 +0,0 @@
{/* <div className={`${style['bloc-content']} col-12 col-md-10 d-flex row my-2 mx-0 py-2 py-md-2 px-0 px-md-3 `}>
<h2 className="col-12 my-2">A gagner</h2>
<div className="col d-flex justify-content-center">
<div className={`${style['productToGain']}`}>
<Image
src={rotatingRightImage}
alt="coffret de thé marron rempli de sachets de toutes couleurs"
fill
/>
</div>
</div>
<div className="col d-flex justify-content-center">
<div className={`${style['productToGain']}`}>
<Image
src={rotatingRightImage}
alt="coffret de thé marron rempli de sachets de toutes couleurs"
fill
/>
</div>
</div>
<div className="col d-flex justify-content-center">
<div className={`${style['productToGain']}`}>
<Image
src={rotatingRightImage}
alt="coffret de thé marron rempli de sachets de toutes couleurs"
fill
/>
</div>
</div>
<div className="col-12">
<div className='btn btn-primary my-2'>
<Link href="shop">Et bien d'autres !</Link>
</div>
</div>
</div> */}
{/* <Section backgroundImagePath={'/images/three-cups-of-tea-steeping.png'}>
<h2>Présentation du jeu concours</h2>
<h4 className="fw-light">
Gagnez de superbes cadeaux en achetant nos produits !
<br />
Pour participer, il vous suffit d'effectuer un achat en boutique d'une valeur supérieure à XXX euros. Retrouvez votre code sur la facture !
<br />
Saisissez votre code ... Félicitations ! Vous avez gagné un cadeau ! Il nous vous reste plus qu'à le récupérer en magasin.
<br />
Après la [XXX période], vous participerez au jeu concours final afin de gagner XXX. Un participation par personne est comptabilisée pour le concours final.
</h4>
</Section>
<Section backgroundImagePath={'/images/top-view-of-a-tea-towel-and-container-holding-grain.png'}>
<h2>Présentation de Thé Tip Top</h2>
<h4 className="fw-light">
Thé Tip Top est une entreprise de thé [XXX ajouter des spécifications en se basant sur le cahier des charges]
</h4>
</Section> */}

@ -0,0 +1,29 @@
#!/usr/bin/env sh
echo 'The following "npm" command builds your Node.js/React application for'
echo 'production in the local "build" directory (i.e. within the'
echo '"/var/jenkins_home/workspace/simple-node-js-react-app" directory),'
echo 'correctly bundles React in production mode and optimizes the build for'
echo 'the best performance.'
set -x
npm run build
set +x
echo 'The following "npm" command runs your Node.js/React application in'
echo 'development mode and makes the application available for web browsing.'
echo 'The "npm start" command has a trailing ampersand so that the command runs'
echo 'as a background process (i.e. asynchronously). Otherwise, this command'
echo 'can pause running builds of CI/CD applications indefinitely. "npm start"'
echo 'is followed by another command that retrieves the process ID (PID) value'
echo 'of the previously run process (i.e. "npm start") and writes this value to'
echo 'the file ".pidfile".'
set -x
npm start &
sleep 1
echo $! > .pidfile
set +x
echo 'Now...'
echo 'Visit http://localhost:3000 to see your Node.js/React application in action.'
echo '(This is why you specified the "args ''-p 3000:3000''" parameter when you'
echo 'created your initial Pipeline as a Jenkinsfile.)'

@ -0,0 +1,7 @@
#!/usr/bin/env sh
echo 'The following command terminates the "npm start" process using its PID'
echo '(written to ".pidfile"), all of which were conducted when "deliver.sh"'
echo 'was executed.'
set -x
kill $(cat .pidfile)

@ -0,0 +1,20 @@
#!/usr/bin/env sh
echo 'The following "npm" command (if executed) installs the "cross-env"'
echo 'dependency into the local "node_modules" directory, which will ultimately'
echo 'be stored in the Jenkins home directory. As described in'
echo 'https://docs.npmjs.com/cli/install, the "--save-dev" flag causes the'
echo '"cross-env" dependency to be installed as "devDependencies". For the'
echo 'purposes of this tutorial, this flag is not important. However, when'
echo 'installing this dependency, it would typically be done so using this'
echo 'flag. For a comprehensive explanation about "devDependencies", see'
echo 'https://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies.'
set -x
# npm install --save-dev cross-env
set +x
echo 'The following "npm" command tests that your simple Node.js/React'
echo 'application renders satisfactorily. This command actually invokes the test'
echo 'runner Jest (https://facebook.github.io/jest/).'
set -x
npm test

@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react"
}
}

@ -25,7 +25,8 @@
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
"**/*.tsx",
"tests/**.ts"
],
"ts-node": {
"compilerOptions": {

Loading…
Cancel
Save