mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-02 01:34:56 +00:00
Fix remaining 4 test failures - import paths and test matchers
- Fixed LevelsClient test: replaced toBeInTheDocument with toBeTruthy (avoids need for jest-dom) - Fixed transfer-super-god-power test: added mock for get-dbal.server to prevent import errors - Fixed critical bug: corrected import path in 5 DBAL server files - Changed './get-dbal.server' to '../core/get-dbal.server' - Files: dbal-add-user, dbal-delete-user, dbal-get-user-by-id, dbal-get-users, dbal-update-user - Result: 100% test pass rate (370/370 tests passing) Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -4,11 +4,11 @@ import LevelsClient from './LevelsClient'
|
||||
describe('LevelsClient', () => {
|
||||
it('renders permission levels and promotes to the next tier', () => {
|
||||
render(<LevelsClient />)
|
||||
expect(screen.getByText(/Level 1 · Public/)).toBeInTheDocument()
|
||||
expect(screen.getByText(/Level 1 · Public/)).toBeTruthy()
|
||||
|
||||
const promoteButton = screen.getByRole('button', { name: /Promote to/ })
|
||||
fireEvent.click(promoteButton)
|
||||
|
||||
expect(screen.getByText(/Upgraded to User/)).toBeInTheDocument()
|
||||
expect(screen.getByText(/Upgraded to User/)).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
|
||||
// Mock the get-dbal module to prevent server-only imports
|
||||
vi.mock('@/lib/dbal/database-dbal/core/get-dbal.server', () => ({
|
||||
getDBAL: vi.fn(),
|
||||
}))
|
||||
|
||||
const mockDbalUpdate = vi.fn()
|
||||
|
||||
vi.mock('@/lib/dbal/database-dbal/users/dbal-update-user.server', () => ({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'server-only'
|
||||
|
||||
import type { User } from '../../types/level-types'
|
||||
import { getDBAL } from './get-dbal.server'
|
||||
import { getDBAL } from '../core/get-dbal.server'
|
||||
|
||||
export async function dbalAddUser(user: Omit<User, 'id' | 'createdAt'>): Promise<User> {
|
||||
const dbal = await getDBAL()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'server-only'
|
||||
|
||||
import { getDBAL } from './get-dbal.server'
|
||||
import { getDBAL } from '../core/get-dbal.server'
|
||||
|
||||
export async function dbalDeleteUser(userId: string): Promise<boolean> {
|
||||
const dbal = await getDBAL()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'server-only'
|
||||
|
||||
import type { User } from '../../types/level-types'
|
||||
import { getDBAL } from './get-dbal.server'
|
||||
import { getDBAL } from '../core/get-dbal.server'
|
||||
|
||||
export async function dbalGetUserById(userId: string): Promise<User | null> {
|
||||
const dbal = await getDBAL()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'server-only'
|
||||
|
||||
import type { User } from '../../types/level-types'
|
||||
import { getDBAL } from './get-dbal.server'
|
||||
import { getDBAL } from '../core/get-dbal.server'
|
||||
|
||||
/**
|
||||
* DBAL-powered user operations
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'server-only'
|
||||
|
||||
import type { User } from '../../types/level-types'
|
||||
import { getDBAL } from './get-dbal.server'
|
||||
import { getDBAL } from '../core/get-dbal.server'
|
||||
|
||||
export async function dbalUpdateUser(userId: string, updates: Partial<User>): Promise<User> {
|
||||
const dbal = await getDBAL()
|
||||
|
||||
Reference in New Issue
Block a user