Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/tests/db.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, test, expect, afterEach, beforeEach } from 'bun:test'
import { describe, test, expect, expectTypeOf, afterEach, beforeEach } from 'bun:test'
import { closeDb, getDb, initializeDb } from '@backend/plugins/database'

describe('Database', () => {
Expand All @@ -10,7 +10,7 @@ describe('Database', () => {
test('should initialize database successfully', async () => {
const db = await initializeDb(':memory:')
expect(db).toBeDefined()
expect(typeof db.run).toBe('function')
expectTypeOf(db.run).toBeFunction()
})

test('getDb should return a database connection', async () => {
Expand All @@ -22,7 +22,7 @@ describe('Database', () => {

// Verify the connection exists and has the expected methods
expect(db).toBeDefined()
expect(typeof db.run).toBe('function')
expectTypeOf(db.run).toBeFunction()
})

test('getDb should throw if database is not initialized', () => {
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('Database', () => {
// Should be able to initialize again
const db = await initializeDb(':memory:')
expect(db).toBeDefined()
expect(typeof db.run).toBe('function')
expectTypeOf(db.run).toBeFunction()
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('useSchemaApi', () => {
setActivePinia(
createTestingPinia({
createSpy: mock,
stubActions: true, // Stub actions since we're testing the composable, not the store
stubActions: false, // Allow actions to work so store state gets updated
}),
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect, beforeEach, mock } from 'bun:test'
import { describe, it, expect, expectTypeOf, beforeEach, mock } from 'bun:test'
import { createTestingPinia } from '@pinia/testing'
import { setActivePinia } from 'pinia'
import { useSchemaStore } from '@frontend/features/wikibase-schema/stores/schema.store'
Expand Down Expand Up @@ -634,7 +634,7 @@ describe('useSchemaStore', () => {
store.addStatement(property, valueMapping)

expect(store.statements[0]?.id).toBeDefined()
expect(typeof store.statements[0]?.id).toBe('string')
expectTypeOf(store.statements[0]!.id).toBeString()
})

it('should create statement with property object', () => {
Expand All @@ -652,7 +652,7 @@ describe('useSchemaStore', () => {
store.addStatement(property, valueMapping)

expect(store.statements[0]?.property).toBeDefined()
expect(typeof store.statements[0]?.property).toBe('object')
expectTypeOf(store.statements[0]!.property).toBeObject()
})

it('should create statement with value object', () => {
Expand All @@ -670,7 +670,7 @@ describe('useSchemaStore', () => {
store.addStatement(property, valueMapping)

expect(store.statements[0]?.value).toBeDefined()
expect(typeof store.statements[0]?.value).toBe('object')
expectTypeOf(store.statements[0]!.value).toBeObject()
})

it('should create statement with default normal rank', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect, beforeEach } from 'bun:test'
import { describe, it, expect, expectTypeOf, beforeEach } from 'bun:test'
import { createPinia, setActivePinia } from 'pinia'
import { useDragDropContext } from '@frontend/shared/composables/useDragDropContext'
import { useDragDropStore } from '@frontend/features/data-processing/stores/drag-drop.store'
Expand Down Expand Up @@ -267,18 +267,18 @@ describe('useDragDropContext', () => {
const context = useDragDropContext()

// Test that all expected methods exist
expect(typeof context.startDrag).toBe('function')
expect(typeof context.endDrag).toBe('function')
expect(typeof context.enterDropZone).toBe('function')
expect(typeof context.leaveDropZone).toBe('function')
expect(typeof context.validateDrop).toBe('function')
expect(typeof context.performDrop).toBe('function')
expect(typeof context.createDropZoneConfig).toBe('function')
expectTypeOf(context.startDrag).toBeFunction()
expectTypeOf(context.endDrag).toBeFunction()
expectTypeOf(context.enterDropZone).toBeFunction()
expectTypeOf(context.leaveDropZone).toBeFunction()
expectTypeOf(context.validateDrop).toBeFunction()
expectTypeOf(context.performDrop).toBeFunction()
expectTypeOf(context.createDropZoneConfig).toBeFunction()
})

it('should work with store setAvailableTargets method', () => {
const store = useDragDropStore()
expect(typeof store.setAvailableTargets).toBe('function')
expectTypeOf(store.setAvailableTargets).toBeFunction()

const targets = [mockDropTarget]
store.setAvailableTargets(targets)
Expand All @@ -289,7 +289,7 @@ describe('useDragDropContext', () => {

it('should work with store getValidTargetsForColumn method', () => {
const store = useDragDropStore()
expect(typeof store.getValidTargetsForColumn).toBe('function')
expectTypeOf(store.getValidTargetsForColumn).toBeFunction()

store.setAvailableTargets([mockDropTarget])
const validTargets = store.getValidTargetsForColumn(mockColumnInfo)
Expand Down
Loading