Skip to content

Commit

Permalink
Change sonar.tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunquakes committed May 29, 2024
1 parent 947601e commit dbac95c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
35 changes: 1 addition & 34 deletions __test__/api/user.test.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
import sqlite3, { Database } from 'sqlite3'
import sqlite3Rewire, {
options,
execute,
save,
list,
page,
count,
getOne,
updateById,
remove
} from '../../src/db/sqlite3'

jest.mock('sqlite3')

beforeEach(() => {
jest.clearAllMocks()
})

describe('Test user api', () => {
test('Test pageList', async () => {
const getDb = sqlite3Rewire.__get__('getDb')
await getDb()
expect(options.db).toBeInstanceOf(Database)

sqlite3.Database = jest.fn().mockImplementation((filePath, callback) => {
if (callback !== undefined) {
callback(new Error('Test'))
}
})

options.db = undefined
await getDb()
expect(options.db).toBeInstanceOf(sqlite3.Database)
})
test('Test pageList', async () => {})
})
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sonar.organization=sunquakes
sonar.projectKey=sunquakes_electron-kits

sonar.exclusions=src/lang/**.ts
sonar.tests=src
sonar.exclusions=src/lang/**.ts,coverage/**
sonar.javascript.lcov.reportPaths=coverage/lcov.info

0 comments on commit dbac95c

Please sign in to comment.