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
| import { TestBed } from '@angular/core/testing'; | |
| import { AppComponent } from './app.component'; | |
| import { HeaderComponent } from './components/header/header.component'; | |
| describe('AppComponent', () => { | |
| beforeEach(async () => { | |
| await TestBed.configureTestingModule({ | |
| declarations: [ | |
| AppComponent, | |
| HeaderComponent |
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
| import { useState } from 'react'; | |
| function useErros(validacoes) { | |
| const estadoInicial = criarEstadoInicial(validacoes); | |
| const [erros, setErros] = useState(estadoInicial); | |
| function validarCampos(event) { | |
| const { name, value } = event.target; |
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
| import { fireEvent, render, screen } from '@testing-library/react'; | |
| import ProductDetail from './ProductDetail'; | |
| import { MemoryRouter } from 'react-router'; | |
| import ProductsService from '../../services/ProductsService'; | |
| import LoadingContext from '../../contexts/LoadingContext'; | |
| jest.mock('../../services/ProductsService'); | |
| const noop = () => { }; |
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
| import { useContext } from "react"; | |
| import FilterContext from "../contexts/FilterContext"; | |
| import Menu from "./Menu"; | |
| function Header() { | |
| const { setFilter } = useContext(FilterContext); | |
| return ( | |
| <header className="header"> |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <beans xmlns="http://www.springframework.org/schema/beans" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" | |
| xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" | |
| xsi:schemaLocation="http://www.springframework.org/schema/mvc | |
| http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd | |
| http://www.springframework.org/schema/beans | |
| http://www.springframework.org/schema/beans/spring-beans-4.0.xsd | |
| http://www.springframework.org/schema/context | |
| http://www.springframework.org/schema/context/spring-context-4.0.xsd |
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
| import { MemoryRouter } from 'react-router'; | |
| import { render, screen } from '@testing-library/react'; | |
| import App from './App'; | |
| import { MemoryRouter } from 'react-router'; | |
| import ListagemVeiculos from './pages/ListagemVeiculos'; | |
| import ListagemUsuarios from './pages/ListagemUsuarios'; | |
| import Pagina404 from './pages/Pagina404'; | |
| import Login from './pages/Login'; |
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
| import { HttpClient, HttpHeaders } from '@angular/common/http'; | |
| import { Injectable } from '@angular/core'; | |
| import { tap } from 'rxjs/operators'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class LoginService { | |
| api = 'http://localhost:3200/login' |
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
| import { Injectable } from '@angular/core'; | |
| import { CanActivate, Router } from '@angular/router'; | |
| import { catchError, map } from 'rxjs/operators'; | |
| import { LoginService } from '../services/login.service'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class Auth2Guard implements CanActivate { |
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
| import { validatorMiddleware } from '../infra/validator' | |
| import { userLoginSchema } from '../controllers/schemas/userLoginSchema.js' | |
| import { UsersRepository } from '../repositories/UsersRepository' | |
| import { UsersService } from '../services/UsersService' | |
| import { LoginController } from '../controllers/LoginController' | |
| module.exports = (app) => { | |
| const users = app.datasource.models.users; | |
| const usersRepository = new UsersRepository(users) |