Skip to content

Instantly share code, notes, and snippets.

Avatar

Lucas Badico LucasBadico

View GitHub Profile
View garage-service.spec.js
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();
View garage-service.spec.js
import { mysql } from '@common/connectors/mysql';
import { GarageRepo, GarageService } from '../../src';
const connection = mysql()('Garage');
@LucasBadico
LucasBadico / garage-repo.js
Created Oct 14, 2019
create method in repository
View garage-repo.js
export default class GarageRepo {
constructor(mysql, redis) {
this.mysql = mysql;
this.redis = redis;
}
create(attributes) {
return this.mysql.create({
input: attributes,
});
@LucasBadico
LucasBadico / garage-service.js
Created Oct 14, 2019
create method on serviço
View garage-service.js
export default class GarageService {
constructor(garageRepo) {
this.repository = garageRepo;
}
async create(data) {
return this.repository.create({
...data,
id: 'mockid'
})
}
View garage-service.spec.js
import { GarageRepo, GarageService } from '../../src';
describe('Garage Service test', () => {
it('should GarageService be defined', () => {
expect(GarageService).toBeDefined();
});
describe('methods', () => {
@LucasBadico
LucasBadico / garage.feature
Last active Oct 14, 2019
garage service bdd
View garage.feature
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"
View index.js
export { default as GarageService } from './lib/garage-service';
export { default as GarageRepo } from './lib/garage-repo';
View garage-repo.js
export default class GarageRepo {
constructor(mysql, redis) {
this.mysql = mysql;
this.redis = redis;
}
}
View garage-service.spec.js
import { GarageRepo, GarageService } from '../../src';
describe('Garage Service test', () => {
it('should GarageService be defined', () => {
expect(GarageService).toBeDefined();
});
})
View backoffice-header.js
import { LitElement, html } from 'lit-element';
class BackofficeHeader extends LitElement {
static get properties() {
return {
title: String,
subtitle: String,
};
}
render(){