Skip to content

Commit 3117d07

Browse files
committed
chore: lint files
1 parent 941cd53 commit 3117d07

File tree

2 files changed

+33
-36
lines changed

2 files changed

+33
-36
lines changed

__tests__/cli/check.test.js

+23-25
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,30 @@ const { resetDatabase, getAllComplianceChecks } = require('../../__utils__')
77

88
const { dbSettings } = getConfig('test')
99

10-
describe('check related commands', () => {
11-
let knex
10+
let knex
1211

13-
beforeAll(() => {
14-
knex = knexInit(dbSettings)
15-
})
16-
beforeEach(async () => {
17-
await resetDatabase(knex)
18-
jest.clearAllMocks()
19-
})
20-
afterEach(jest.clearAllMocks)
21-
afterAll(async () => {
22-
await resetDatabase(knex)
23-
await knex.destroy()
24-
})
25-
describe('list - Non-Interactive Mode', () => {
26-
jest.spyOn(inquirer, 'prompt').mockImplementation(async () => ({}))
12+
beforeAll(() => {
13+
knex = knexInit(dbSettings)
14+
})
15+
beforeEach(async () => {
16+
await resetDatabase(knex)
17+
jest.clearAllMocks()
18+
})
19+
afterEach(jest.clearAllMocks)
20+
afterAll(async () => {
21+
await resetDatabase(knex)
22+
await knex.destroy()
23+
})
24+
describe('list - Non-Interactive Mode', () => {
25+
jest.spyOn(inquirer, 'prompt').mockImplementation(async () => ({}))
2726

28-
test('Should provide a list of available workflows', async () => {
29-
const checks = await getAllComplianceChecks(knex)
30-
// Ensure that there are checks available
31-
expect(checks.length).not.toBe(0)
32-
// Filter relevant checks
33-
const relevantChecks = checks.filter(check => check.implementation_status === 'completed')
34-
const availableChecksList = await listCheckCommand(knex)
35-
await expect(availableChecksList).toEqual(relevantChecks)
36-
})
27+
test('Should provide a list of available workflows', async () => {
28+
const checks = await getAllComplianceChecks(knex)
29+
// Ensure that there are checks available
30+
expect(checks.length).not.toBe(0)
31+
// Filter relevant checks
32+
const relevantChecks = checks.filter(check => check.implementation_status === 'completed')
33+
const availableChecksList = await listCheckCommand(knex)
34+
await expect(availableChecksList).toEqual(relevantChecks)
3735
})
3836
})

src/cli/checks.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ const { initializeStore } = require('../store')
22
const { logger } = require('../utils')
33

44
async function listCheckCommand (knex, options = {}) {
5-
const { getAllComplianceChecks } = initializeStore(knex)
6-
const checks = await getAllComplianceChecks(knex)
7-
const implementedChecks = checks.filter(check => check['implementation_status'] === "completed")
8-
implementedChecks.forEach(check => {
9-
logger.log(`- ${check['code_name']}: ${check.title}`)
10-
})
11-
logger.log('------------------------------------')
12-
logger.log(`Implemented checks: ${implementedChecks.length}/${checks.length}.`)
13-
return implementedChecks
5+
const { getAllComplianceChecks } = initializeStore(knex)
6+
const checks = await getAllComplianceChecks(knex)
7+
const implementedChecks = checks.filter(check => check.implementation_status === 'completed')
8+
implementedChecks.forEach(check => {
9+
logger.log(`- ${check.code_name}: ${check.title}`)
10+
})
11+
logger.log('------------------------------------')
12+
logger.log(`Implemented checks: ${implementedChecks.length}/${checks.length}.`)
13+
return implementedChecks
1414
}
1515

1616
module.exports = {
17-
listCheckCommand
17+
listCheckCommand
1818
}
19-

0 commit comments

Comments
 (0)