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
export { default as GarageService } from './lib/garage-service'; | |
export { default as GarageRepo } from './lib/garage-repo'; |
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
Esquema do Cenário: Cadastro da oficina | |
Dado que estou na tela para cadastrar uma oficina | |
Quando informo os seguintes dados: | |
| nome | Della Via - Ipiranga | | |
| cep | 04278000 | | |
| num | 664 | | |
| credenciado | <credenciado> | | |
E clico no botão salvar | |
Então eu devo ver a mensagem de sucesso "Oficina cadastrada com sucesso" | |
E o endereço deve estar cadastrado no banco de dados com todas as informações e o status deve ser "ACTIVE" |
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
import { GarageRepo, GarageService } from '../../src'; | |
describe('Garage Service test', () => { | |
it('should GarageService be defined', () => { | |
expect(GarageService).toBeDefined(); | |
}); | |
describe('methods', () => { |
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
export default class GarageService { | |
constructor(garageRepo) { | |
this.repository = garageRepo; | |
} | |
async create(data) { | |
return this.repository.create({ | |
...data, | |
id: 'mockid' | |
}) | |
} |
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
export default class GarageRepo { | |
constructor(mysql, redis) { | |
this.mysql = mysql; | |
this.redis = redis; | |
} | |
create(attributes) { | |
return this.mysql.create({ | |
input: attributes, | |
}); |
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
import { mysql } from '@common/connectors/mysql'; | |
import { GarageRepo, GarageService } from '../../src'; | |
const connection = mysql()('Garage'); |
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
import { mysql } from '@common/connectors/mysql'; | |
import { GarageRepo, GarageService } from '../../src'; | |
const connection = mysql()('Garage'); | |
describe('Garage Service test', () => { | |
it('should GarageService be defined', () => { | |
expect(GarageService).toBeDefined(); |
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
/* | |
tem rodas | |
anda de ponto a ponto b | |
tem peso | |
*/ | |
class Vehicle { | |
// dado | |
constructor({ | |
model, | |
color, |
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
const { useState, useEffect } = React; | |
function App() { | |
const [posts, setPosts] = useState([]); | |
useEffect(() => { | |
axios.get('https://jsonplaceholder.typicode.com/posts').then((res) => { | |
setPosts(res.data.slice(0, 10)); | |
console.log(posts); | |
}); |
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
const items = [1, 2, 3, 4, 5]; | |
const results = []; | |
for (let i = 0; i < items.lenght; i++){ | |
results[i] = items[i]*2; | |
} | |
console.log(results); |