Skip to content

Commit

Permalink
Add test for GenerateMockDataService
Browse files Browse the repository at this point in the history
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
Cruikshanks committed Aug 11, 2023
1 parent af7547e commit 20c1896
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/services/data/mock/generate-mock-data.service.test.js
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()
})
})
})

0 comments on commit 20c1896

Please sign in to comment.