Skip to content

Commit

Permalink
mock logger in readStore
Browse files Browse the repository at this point in the history
  • Loading branch information
BuZZ-T committed Aug 3, 2021
1 parent 9750235 commit 6b5ae47
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion store/readStore.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import * as fs from 'fs'
import { mocked } from 'ts-jest/utils'
import { MaybeMockedDeep } from 'ts-jest/dist/utils/testing'

import { readStoreFile } from './readStore'
import { IStoreConfig } from '../interfaces'
import { createStore, PromisifyCallback, PROMISIFY_NO_ERROR } from '../test.utils'
import { LoggerSpinner, logger } from '../loggerSpinner'

jest.mock('fs')
jest.mock('../loggerSpinner')

describe('readStore', () => {

describe('readStoreFile', () => {

let fsMock: any
let fsMock: MaybeMockedDeep<any>
let loggerSpinnerMock: MaybeMockedDeep<LoggerSpinner>

beforeEach(() => {
fsMock = mocked(fs, true)
fsMock.readFile.mockReset()

loggerSpinnerMock = mocked(logger, true)
loggerSpinnerMock.start.mockClear()
loggerSpinnerMock.success.mockClear()
loggerSpinnerMock.error.mockClear()
})

it('should return the parsed store received from the file system', async () => {
Expand Down

0 comments on commit 6b5ae47

Please sign in to comment.