-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for GenerateMockDataService
The service is just picking random from arrays of fixed values. We feel there is very little we need to cover so the tests just ensure that the service is 'working'.
- Loading branch information
1 parent
af7547e
commit 20c1896
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
test/services/data/mock/generate-mock-data.service.test.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict' | ||
|
||
// Test framework dependencies | ||
const Lab = require('@hapi/lab') | ||
const Code = require('@hapi/code') | ||
|
||
const { describe, it } = exports.lab = Lab.script() | ||
const { expect } = Code | ||
|
||
// Thing under test | ||
const GenerateMockDataService = require('../../../../app/services/data/mock/generate-mock-data.service.js') | ||
|
||
describe('Generate Bill Run service', () => { | ||
describe('when called', () => { | ||
it('generates a fake name', () => { | ||
const result = GenerateMockDataService.go() | ||
|
||
expect(result.name).to.exist() | ||
expect(result.name).to.be.a.string() | ||
}) | ||
|
||
it('generates a fake address', () => { | ||
const result = GenerateMockDataService.go() | ||
|
||
expect(result.address).to.exist() | ||
expect(result.address).to.be.an.array() | ||
expect(result.address).to.have.length(3) | ||
expect(result.address[0]).to.be.a.string() | ||
}) | ||
}) | ||
}) |