Skip to content

Commit

Permalink
chore(KUI-1537): replaced mockery with jest
Browse files Browse the repository at this point in the history
  • Loading branch information
axelbjo committed Oct 25, 2024
1 parent 813f468 commit 4c306d6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 81 deletions.
122 changes: 52 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"jest-extended": "^4.0.2",
"lint-staged": "^15.2.5",
"mini-css-extract-plugin": "^2.9.0",
"mockery": "^2.1.0",
"nock": "^13.5.4",
"node-mocks-http": "^1.14.1",
"node-notifier": "^10.0.1",
Expand Down
17 changes: 7 additions & 10 deletions test/unit/test-MemoCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@

const { expect } = require('chai')
const nock = require('nock')
const mockery = require('mockery')
const httpMocks = require('node-mocks-http')

const mockLogger = {}
mockLogger.debug = mockLogger.info = mockLogger.error = mockLogger.warn = () => {}
mockLogger.init = () => {}

mockery.registerMock('@kth/log', mockLogger)
mockery.enable({
warnOnReplace: false,
warnOnUnregistered: false,
})
jest.mock('@kth/log', () => ({
debug: jest.fn(),
info: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
init: jest.fn(),
}))

const paths = require('../mocks/apipaths.json')
const api = nock('http://localhost:3001/api/node').get('/_paths').reply(200, paths).get('/_checkAPIkey').reply(200, {})
Expand Down

0 comments on commit 4c306d6

Please sign in to comment.