Add configuration files and update project documentation

- Introduced .editorconfig for consistent coding styles across the project.
- Added .golangci.yml for Go linting configuration.
- Updated AGENTS.md to clarify project structure and components.
- Enhanced CONTRIBUTING.md with Makefile usage for common tasks.
- Updated Dockerfiles to use Go 1.24 and improved build instructions.
- Refined README.md and deployment documentation for clarity.
- Added testing documentation in testing.md for backend and frontend tests.
- Introduced Makefile for streamlined development commands and tasks.
This commit is contained in:
2026-03-01 01:51:47 +03:00
parent 0466ff3087
commit 6529d7370e
92 changed files with 13411 additions and 8438 deletions

View File

@@ -0,0 +1,93 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
const useRuntimeConfigMock = vi.fn()
vi.stubGlobal('useRuntimeConfig', useRuntimeConfigMock)
import { useAppPaths } from '../useAppPaths'
describe('useAppPaths with default base /', () => {
beforeEach(() => {
useRuntimeConfigMock.mockReturnValue({ app: { baseURL: '/' } })
})
it('returns base as empty string for "/"', () => {
const { base } = useAppPaths()
expect(base).toBe('')
})
it('pathWithoutBase returns path unchanged', () => {
const { pathWithoutBase } = useAppPaths()
expect(pathWithoutBase('/login')).toBe('/login')
expect(pathWithoutBase('/admin/users')).toBe('/admin/users')
expect(pathWithoutBase('/')).toBe('/')
})
it('resolvePath returns path as-is', () => {
const { resolvePath } = useAppPaths()
expect(resolvePath('/login')).toBe('/login')
expect(resolvePath('admin')).toBe('/admin')
})
it('isLoginPath detects login', () => {
const { isLoginPath } = useAppPaths()
expect(isLoginPath('/login')).toBe(true)
expect(isLoginPath('/admin/login')).toBe(true)
expect(isLoginPath('/admin')).toBe(false)
expect(isLoginPath('/')).toBe(false)
})
it('isSetupPath detects setup', () => {
const { isSetupPath } = useAppPaths()
expect(isSetupPath('/setup')).toBe(true)
expect(isSetupPath('/other/setup')).toBe(true)
expect(isSetupPath('/')).toBe(false)
expect(isSetupPath('/login')).toBe(false)
})
})
describe('useAppPaths with custom base /map', () => {
beforeEach(() => {
useRuntimeConfigMock.mockReturnValue({ app: { baseURL: '/map/' } })
})
it('strips base from path', () => {
const { base, pathWithoutBase } = useAppPaths()
expect(base).toBe('/map')
expect(pathWithoutBase('/map/login')).toBe('/login')
expect(pathWithoutBase('/map/admin/users')).toBe('/admin/users')
expect(pathWithoutBase('/map/')).toBe('/')
expect(pathWithoutBase('/map')).toBe('/')
})
it('resolvePath prepends base', () => {
const { resolvePath } = useAppPaths()
expect(resolvePath('/login')).toBe('/map/login')
expect(resolvePath('admin')).toBe('/map/admin')
})
it('isLoginPath with base', () => {
const { isLoginPath } = useAppPaths()
expect(isLoginPath('/map/login')).toBe(true)
expect(isLoginPath('/login')).toBe(true)
expect(isLoginPath('/map/admin')).toBe(false)
})
it('isSetupPath with base', () => {
const { isSetupPath } = useAppPaths()
expect(isSetupPath('/map/setup')).toBe(true)
expect(isSetupPath('/setup')).toBe(true)
expect(isSetupPath('/map/login')).toBe(false)
})
})
describe('useAppPaths with no baseURL', () => {
beforeEach(() => {
useRuntimeConfigMock.mockReturnValue({ app: {} })
})
it('defaults to /', () => {
const { baseURL, base } = useAppPaths()
expect(baseURL).toBe('/')
expect(base).toBe('')
})
})