Skip to content

Commit

Permalink
Refactor Makefile and reorganize test files
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmolyuk committed Apr 6, 2024
1 parent a3a6cda commit a02e82e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lint:
@PHONY: lint

test:
npx jest --detectOpenHandles tests/*.test.js
npx jest
@PHONY: test

upgrade:
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/index.test.js → __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { describe, it, expect } = require('@jest/globals')

const { Leader } = require('../index')
const { mockDb, mockCollection } = require('./mocks')
const { mockDb, mockCollection } = require('./__mocks__/db')

describe('Leader', () => {
describe('constructor', () => {
Expand Down Expand Up @@ -48,6 +48,7 @@ describe('Leader', () => {
const result = await leader.isLeader()
// Assert
expect(result).toBe(true)
expect(mockCollection.findOne).toHaveBeenCalled()
} finally {
// Cleanup
leader.pause()
Expand Down
7 changes: 7 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = async () => {
return {
verbose: true,
collectCoverage: true,
testPathIgnorePatterns: ['node_modules', '__mocks__']
}
}

0 comments on commit a02e82e

Please sign in to comment.