Repository navigation
Expand file tree
/
Copy pathnetwork-table.test.ts
More file actions
49 lines (43 loc) · 1.66 KB
/
Copy pathnetwork-table.test.ts
File metadata and controls
49 lines (43 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
import { fixture } from '@open-wc/testing-helpers'
import { html } from 'lit'
import { afterEach, describe, expect, it } from 'vitest'
import './copy-button.js'
import './network-card.js'
import './network-table.js'
import { NetworkTable } from './network-table.js'
import { makePublicNetwork } from './fixtures.js'
describe('network-table', () => {
afterEach(() => {
document.body.innerHTML = ''
})
it('mounts without error and renders a card', async () => {
const el = await fixture<NetworkTable>(
html`<network-table
.networks=${[makePublicNetwork()]}
></network-table>`
)
expect(el).toBeInstanceOf(NetworkTable)
expect(el.shadowRoot!.querySelectorAll('network-card')).toHaveLength(1)
})
it('marks activeSession from session status, not session presence', async () => {
const network = makePublicNetwork({ id: 'net-1' })
const el = await fixture<NetworkTable>(
html`<network-table
.networks=${[network]}
.activeSessions=${[
{
id: 'sess-1',
network,
status: 'disconnected',
accessToken: 'token',
} as never,
]}
></network-table>`
)
const card = el.shadowRoot!.querySelector('network-card') as
(HTMLElement & { activeSession: boolean }) | null
expect(card?.activeSession).toBe(false)
})
})