Skip to content

Instantly share code, notes, and snippets.

@LucasBadico
Created October 14, 2019 19:46
Show Gist options
  • Save LucasBadico/ff4beec11aee88cd92c99b1b081d6b1e to your computer and use it in GitHub Desktop.
Save LucasBadico/ff4beec11aee88cd92c99b1b081d6b1e to your computer and use it in GitHub Desktop.
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();
});
describe('methods', () => {
it('create method should receive data and save it on db', async (done) => {
const repo = new GarageRepo(connection);
const service = new GarageService(repo);
try {
const garage = await service.create({
name: 'garage name',
address_postal_code: '09974385',
address_street_number: '322',
reseller_trusted: true,
});
expect(garage).toHaveProperty('id');
} catch(err){
return done(err)
}
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment