Created
October 14, 2019 19:46
-
-
Save LucasBadico/ff4beec11aee88cd92c99b1b081d6b1e to your computer and use it in GitHub Desktop.
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(); | |
}); | |
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