Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 10f4cd1

Browse files
fix: Add test to count slides after start. (#288)
1 parent 957384f commit 10f4cd1

7 files changed

Lines changed: 43 additions & 14 deletions

File tree

__tests__/landing-page.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { render } from "@testing-library/react"
2+
import React from "react"
3+
4+
import Index from "../src/pages/index"
5+
6+
test("renders deploy link", async () => {
7+
const { getByText } = render(<Index />)
8+
const title = getByText(/Stand up/)
9+
expect(title).toBeInTheDocument()
10+
const brand = getByText(/LA FABRIQUE NUMERIQUE/)
11+
expect(brand).toBeInTheDocument()
12+
const button = getByText("Commencer")
13+
expect(button).toBeInTheDocument()
14+
})

__tests__/start-standup.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { queryAllByAttribute } from "@testing-library/dom"
2+
import { fireEvent, render } from "@testing-library/react"
3+
import React from "react"
4+
5+
import Index from "../src/pages/index"
6+
7+
test("renders deploy link", async () => {
8+
const component = render(<Index />)
9+
const { getByText } = component
10+
const button = getByText("Commencer")
11+
const getById = queryAllByAttribute.bind(null, "id")
12+
13+
fireEvent.click(button)
14+
const items = await getById(component.container, /slide-[0-9]/)
15+
expect(items.length).toBeGreaterThanOrEqual(2)
16+
})

__tests__/test-one.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ module.exports = {
1313
setupFilesAfterEnv: ["<rootDir>/config/jest/setup.js"],
1414
testPathIgnorePatterns: ["/node_modules/", "/.next/"],
1515
transform: {
16+
"\\.yml$": "yaml-jest",
1617
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
1718
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
18-
"^.+\\.yml$": "<rootDir>/config/jest/jsYamlLoader.js",
1919
},
2020
transformIgnorePatterns: [
2121
"/node_modules/",

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"devDependencies": {
3535
"@socialgouv/eslint-config-react": "^1.32.0",
36+
"@testing-library/dom": "^7.24.2",
3637
"@testing-library/jest-dom": "^5.11.4",
3738
"@testing-library/react": "^11.0.4",
3839
"babel-jest": "^26.3.0",
@@ -43,6 +44,7 @@
4344
"identity-obj-proxy": "^3.0.0",
4445
"jest": "^26.4.2",
4546
"prettier": "^2.1.2",
46-
"react-test-renderer": "^16.13.1"
47+
"react-test-renderer": "^16.13.1",
48+
"yaml-jest": "^1.0.5"
4749
}
4850
}

src/utils/slides.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import extraSlides from "../slides.yml"
55

66
const SlidesContext = React.createContext()
77

8-
export const SlidesProvider = ({ teams, posts, children }) => {
8+
export const SlidesProvider = ({ teams = [], posts = [], children }) => {
99
const getTeam = (slug) => teams.find((team) => slug === team.slug)
1010
const getMissingTeams = () => teams.filter((team) => !hasPost(team))
1111
const hasPost = (team) => posts.find((post) => post.team_slug === team.slug)

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5266,7 +5266,7 @@ js-yaml-loader@^1.2.2:
52665266
loader-utils "^1.2.3"
52675267
un-eval "^1.2.0"
52685268

5269-
js-yaml@^3.13.1:
5269+
js-yaml@^3.13.1, js-yaml@^3.7.0:
52705270
version "3.14.0"
52715271
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482"
52725272
integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==
@@ -8552,6 +8552,13 @@ yallist@^4.0.0:
85528552
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
85538553
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
85548554

8555+
yaml-jest@^1.0.5:
8556+
version "1.0.5"
8557+
resolved "https://registry.yarnpkg.com/yaml-jest/-/yaml-jest-1.0.5.tgz#288e541bae1b551d113d4864d6cb8f316e1bd331"
8558+
integrity sha1-KI5UG64bVR0RPUhk1suPMW4b0zE=
8559+
dependencies:
8560+
js-yaml "^3.7.0"
8561+
85558562
yargs-parser@^18.1.2:
85568563
version "18.1.3"
85578564
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"

0 commit comments

Comments
 (0)