// __tests__/login.js
import React from 'react'
import {render, fireEvent} from '@testing-library/react'
import Login from '../login'
test('calls onSubmit with the username and password when submit is clicked', () => {
const handleSubmit = jest.fn()
const {getByLabelText, getByText} = render(<Login onSubmit={handleSubmit} />)
const user = {username: 'michelle', password: 'smith'}
fireEvent.change(getByLabelText(/username/i), {
This file contains hidden or 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
const NAME = Symbol(); | |
const person = { | |
[NAME]: 'Flavio' | |
}; | |
person[NAME]; //'Flavio' | |
const RUN = Symbol(); | |
person[RUN] = () => 'Person is running'; | |
console.log(person[RUN]()); //'Person is running' |
.btn {
background-color: red;
color: white;
padding: 20px;
}
// Get the element
<comp
role="alert|log|status|progressbar|marquee|timer|region"
aria-live="POLITENESS_SETTING = [off]|polite|assertive"
aria-controls="IDLIST"
aria-atomic="BOOLEAN = true|false"
aria-relevant="LIST_OF_CHANGES"
aria-labelledby="IDLIST"
aria-describedby="IDLIST"
aria-label="LABEL"
This file contains hidden or 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
// fetch("http://localhost:3000/people") | |
// .then(response => response.json()) | |
// .then(people => { | |
// return people.map(person => { | |
// return fetch("http://localhost:3000/person" + person.id + "/address") | |
// .then(response => response.json()) | |
// .then(address => { | |
// person.address = address; | |
// return person; | |
// }); |
This file contains hidden or 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
// https://github.com/santiq/nodejs-auth/tree/master/src/middlewares | |
import * as argon2 from 'argon2'; | |
import * as jwt from 'jsonwebtoken'; | |
class AuthService { | |
public async Login(email, password): Promise<any> { | |
const userRecord = await UserModel.findOne({ email }); | |
if (!userRecord) { | |
throw new Error('User not found') |
- Write Clean Code
- TDD
- Test Pyramid
- Pair Programming
- Organize your Tech Debt