Import the client, server, skills, tests, and build scripts as the starting point for the rebuild, then trim the surfaces this project does not ship: Electron desktop packaging, the marketing website, and the ESP32 firmware tree. CI keeps the web build, e2e, lockfile, release, and Docker workflows. Rename the package and CLI entry points to hermes-ui, drop the prepare hook so npm ci no longer triggers a build, and drop the removed tsconfig and nodemon references. Rewrite AGENTS.md, ARCHITECTURE.md, DEVELOPMENT.md, and the READMEs so the documented package map and hard rules match this repository. reference_code/ is ignored: it is a read-only snapshot, not an input to the build.
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { mount } from '@vue/test-utils'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
vi.mock('vue-i18n', () => ({
|
|
useI18n: () => ({
|
|
t: (key: string) => key,
|
|
}),
|
|
}))
|
|
|
|
import PlatformCard from '@/components/hermes/settings/PlatformCard.vue'
|
|
|
|
function mountCard(credentials: Record<string, any>) {
|
|
return mount(PlatformCard, {
|
|
props: {
|
|
platformKey: 'matrix',
|
|
name: 'Matrix',
|
|
icon: '<svg></svg>',
|
|
config: {},
|
|
credentials,
|
|
},
|
|
global: {
|
|
stubs: {
|
|
NTag: {
|
|
props: ['type'],
|
|
template: '<span class="tag" :data-type="type"><slot /></span>',
|
|
},
|
|
NAlert: {
|
|
template: '<div><slot /></div>',
|
|
},
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
describe('PlatformCard', () => {
|
|
it('treats Matrix password login as configured only with homeserver, user id, and password', () => {
|
|
expect(mountCard({
|
|
extra: {
|
|
homeserver: 'https://matrix.example.org',
|
|
user_id: '@hermes:example.org',
|
|
password: 'secret',
|
|
},
|
|
}).find('.platform-card').classes()).toContain('configured')
|
|
|
|
expect(mountCard({
|
|
extra: {
|
|
homeserver: 'https://matrix.example.org',
|
|
password: 'secret',
|
|
},
|
|
}).find('.platform-card').classes()).not.toContain('configured')
|
|
})
|
|
|
|
it('treats Matrix access-token login as configured with a homeserver and token', () => {
|
|
expect(mountCard({
|
|
token: 'syt_token',
|
|
extra: {
|
|
homeserver: 'https://matrix.example.org',
|
|
},
|
|
}).find('.platform-card').classes()).toContain('configured')
|
|
|
|
expect(mountCard({
|
|
token: 'syt_token',
|
|
extra: {},
|
|
}).find('.platform-card').classes()).not.toContain('configured')
|
|
})
|
|
})
|