Skip to content

Commit

Permalink
chore(deps): update dependency eslint-config-love to v96
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangalsterer committed Oct 27, 2024
1 parent 3e14c14 commit 23461e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 27 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@jest/globals": "29.7.0",
"@testcontainers/postgresql": "10.13.2",
"@types/jest": "29.5.14",
"eslint-config-love": "89.0.1",
"eslint-config-love": "96.0.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-simple-import-sort": "12.1.1",
"jest": "29.7.0",
Expand Down
6 changes: 2 additions & 4 deletions test/metricsPgPromise.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import { Histogram, type Registry } from 'prom-client'
import { PgPromisePrometheusExporter } from '../src/pgPromisePrometheusExporter'

jest.mock('prom-client', () => ({
Histogram: jest.fn(() => {
return {
Histogram: jest.fn(() => ({
set: jest.fn(),
get: jest.fn()
}
})
}))
}))

describe('all metrics are created with the correct parameters', () => {
Expand Down
24 changes: 6 additions & 18 deletions test/monitorPgPromiseIT.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,13 @@ describe('it for pgPromisePrometheusExporter', () => {
})

test('it task metrics', async () => {
let result = await db.task('my-task', (t: { any: (arg0: string) => unknown }) => {
return t.any('SELECT NOW()')
})
let result = await db.task('my-task', (t: { any: (arg0: string) => unknown }) => t.any('SELECT NOW()'))
let pgTaskDurationSecondsMetric = await register.getSingleMetric('pg_task_duration_seconds')?.get()
expect(pgTaskDurationSecondsMetric?.type).toEqual('histogram')
expect(getValueByName('pg_task_duration_seconds_count', pgTaskDurationSecondsMetric?.values)?.value).toEqual(1)

// eslint-disable-next-line @typescript-eslint/no-unused-vars
result = await db.task('my-task', (t: { any: (arg0: string) => unknown }) => {
return t.any('SELECT NOW()')
})
result = await db.task('my-task', (t: { any: (arg0: string) => unknown }) => t.any('SELECT NOW()'))
pgTaskDurationSecondsMetric = await register.getSingleMetric('pg_task_duration_seconds')?.get()
expect(getValueByName('pg_task_duration_seconds_count', pgTaskDurationSecondsMetric?.values)?.value).toEqual(2)
expect(getValueByName('pg_task_duration_seconds_sum', pgTaskDurationSecondsMetric?.values)?.value).toBeGreaterThanOrEqual(0)
Expand All @@ -106,9 +102,7 @@ describe('it for pgPromisePrometheusExporter', () => {
test.each(taskMetrics)('it task metric "%s" is emitted with default labels', async (metricName) => {
const expectedLabels = { foo: 'bar', alice: 2 }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const result = await db.task('my-task', (t: { any: (arg0: string) => unknown }) => {
return t.any('SELECT NOW()')
})
const result = await db.task('my-task', (t: { any: (arg0: string) => unknown }) => t.any('SELECT NOW()'))

const metric = await register.getSingleMetric('pg_task_duration_seconds')?.get()
expect(metric).toBeDefined()
Expand All @@ -120,17 +114,13 @@ describe('it for pgPromisePrometheusExporter', () => {
})

test('it transaction metrics', async () => {
let result = await db.tx('my-tx', (t: { any: (arg0: string) => unknown }) => {
return t.any('SELECT NOW()')
})
let result = await db.tx('my-tx', (t: { any: (arg0: string) => unknown }) => t.any('SELECT NOW()'))
let pgTransactionDurationSecondsMetric = await register.getSingleMetric('pg_transaction_duration_seconds')?.get()
expect(pgTransactionDurationSecondsMetric?.type).toEqual('histogram')
expect(getValueByName('pg_transaction_duration_seconds_count', pgTransactionDurationSecondsMetric?.values)?.value).toEqual(1)

// eslint-disable-next-line @typescript-eslint/no-unused-vars
result = await db.tx('my-tx', (t: { any: (arg0: string) => unknown }) => {
return t.any('SELECT NOW()')
})
result = await db.tx('my-tx', (t: { any: (arg0: string) => unknown }) => t.any('SELECT NOW()'))
pgTransactionDurationSecondsMetric = await register.getSingleMetric('pg_transaction_duration_seconds')?.get()
expect(getValueByName('pg_transaction_duration_seconds_count', pgTransactionDurationSecondsMetric?.values)?.value).toEqual(2)
expect(getValueByName('pg_transaction_duration_seconds_sum', pgTransactionDurationSecondsMetric?.values)?.value).toBeGreaterThanOrEqual(0)
Expand All @@ -139,9 +129,7 @@ describe('it for pgPromisePrometheusExporter', () => {
test.each(transactionMetrics)('it transaction metric "%s" is emitted with default labels', async (metricName) => {
const expectedLabels = { foo: 'bar', alice: 2 }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const result = await db.tx('my-tx', (t: { any: (arg0: string) => unknown }) => {
return t.any('SELECT NOW()')
})
const result = await db.tx('my-tx', (t: { any: (arg0: string) => unknown }) => t.any('SELECT NOW()'))

const metric = await register.getSingleMetric('pg_transaction_duration_seconds')?.get()
expect(metric).toBeDefined()
Expand Down

0 comments on commit 23461e2

Please sign in to comment.