-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
758 additions
and
73 deletions.
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 |
---|---|---|
@@ -1,8 +1,18 @@ | ||
language: java | ||
jdk: openjdk8 | ||
sudo: true | ||
jobs: | ||
include: | ||
- language: java | ||
jdk: openjdk8 | ||
sudo: true | ||
script: | ||
- ./gradlew assemble | ||
- ./gradlew check | ||
- ./gradlew buildOfficial | ||
|
||
script: | ||
- ./gradlew assemble | ||
- ./gradlew check | ||
- ./gradlew buildOfficial | ||
- language: node_js | ||
node_js: 10 | ||
script: | ||
- cd tnoodle-ui | ||
- npm install | ||
- npm test -- --coverage | ||
after_script: | ||
- COVERALLS_REPO_TOKEN=$coveralls_repo_token npm run coveralls |
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 |
---|---|---|
@@ -1,46 +1,48 @@ | ||
{ | ||
"name": "tnoodle-ui", | ||
"version": "0.1.0", | ||
"private": true, | ||
"homepage": "http://localhost:2014/scramble", | ||
"proxy": "http://localhost:2014", | ||
"dependencies": { | ||
"@testing-library/jest-dom": "^4.2.4", | ||
"@testing-library/react": "^9.3.2", | ||
"@testing-library/user-event": "^7.1.2", | ||
"bootstrap": "^4.4.1", | ||
"fetch-intercept": "^2.3.1", | ||
"node-sass": "^4.13.1", | ||
"react": "^16.12.0", | ||
"react-bootstrap": "^1.0.0-beta.16", | ||
"react-dom": "^16.12.0", | ||
"react-icons": "^3.10.0", | ||
"react-redux": "^7.1.3", | ||
"react-router-dom": "^5.1.2", | ||
"react-scripts": "3.4.3", | ||
"redux": "^4.0.5" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test --watchAll --watchAll=false", | ||
"eject": "react-scripts eject", | ||
"predeploy": "npm run build", | ||
"deploy": "gh-pages -d build" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
"name": "tnoodle-ui", | ||
"version": "0.1.0", | ||
"private": true, | ||
"homepage": "http://localhost:2014/scramble", | ||
"proxy": "http://localhost:2014", | ||
"dependencies": { | ||
"@testing-library/jest-dom": "^4.2.4", | ||
"@testing-library/react": "^9.3.2", | ||
"@testing-library/user-event": "^7.1.2", | ||
"bootstrap": "^4.4.1", | ||
"fetch-intercept": "^2.3.1", | ||
"node-sass": "^4.13.1", | ||
"react": "^16.12.0", | ||
"react-bootstrap": "^1.0.0-beta.16", | ||
"react-dom": "^16.12.0", | ||
"react-icons": "^3.10.0", | ||
"react-redux": "^7.1.3", | ||
"react-router-dom": "^5.1.2", | ||
"react-scripts": "3.4.3", | ||
"redux": "^4.0.5" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test --watchAll --watchAll=false", | ||
"eject": "react-scripts eject", | ||
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^3.1.0" | ||
} | ||
} |
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,67 @@ | ||
import React from "react"; | ||
import { act } from "react-dom/test-utils"; | ||
|
||
import { render, unmountComponentAtNode } from "react-dom"; | ||
import { fireEvent } from "@testing-library/react"; | ||
|
||
import { Provider } from "react-redux"; | ||
import store from "../redux/Store"; | ||
|
||
import EntryInterface from "./EntryInterface"; | ||
|
||
let container = null; | ||
beforeEach(() => { | ||
// setup a DOM element as a render target | ||
container = document.createElement("div"); | ||
document.body.appendChild(container); | ||
}); | ||
|
||
afterEach(() => { | ||
// cleanup on exiting | ||
unmountComponentAtNode(container); | ||
container.remove(); | ||
container = null; | ||
}); | ||
|
||
it("Competition name should be already filled with current date", () => { | ||
// Render component | ||
act(() => { | ||
render( | ||
<Provider store={store}> | ||
<EntryInterface /> | ||
</Provider>, | ||
container | ||
); | ||
}); | ||
|
||
const today = new Date().toISOString().split("T")[0]; | ||
|
||
const competitionNameInput = container.querySelector("#competition-name"); | ||
expect(competitionNameInput.value).toEqual("Scrambles for " + today); | ||
}); | ||
|
||
it("Password should toggle", () => { | ||
// Render component | ||
act(() => { | ||
render( | ||
<Provider store={store}> | ||
<EntryInterface /> | ||
</Provider>, | ||
container | ||
); | ||
}); | ||
|
||
const input = container.querySelector("#password"); | ||
const passwordToggler = container.querySelector(".input-group-prepend"); | ||
|
||
fireEvent.change(input, { target: { value: "123456" } }); | ||
|
||
// Type password at first | ||
expect(input.type).toBe("password"); | ||
|
||
// After the click, it should be type text | ||
fireEvent.click(passwordToggler); | ||
expect(input.type).toBe("text"); | ||
|
||
expect(input.value).toBe("123456"); | ||
}); |
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
Oops, something went wrong.