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
4 changes: 2 additions & 2 deletions ui/tests/pages/Applications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ it('allows deleting only a project with no applications', async () => {
await flushPromises()
const [shop, empty] = wrapper.findAllComponents(ProjectCard)

expect(deleteButton(shop).attributes('disabled')).toBeDefined()
expect(deleteButton(empty).attributes('disabled')).toBeUndefined()
expect(deleteButton(shop!).attributes('disabled')).toBeDefined()
expect(deleteButton(empty!).attributes('disabled')).toBeUndefined()
})

it("shows a project's New Application, Edit and Delete as icons, in that order", async () => {
Expand Down
12 changes: 9 additions & 3 deletions ui/tests/pages/Domains.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,13 @@ describe('the Domains page', () => {
await flushPromises()

const [pooled, plain] = wrapper.findAll('[data-domain]')
expect(pooled!.getComponent('[data-application]').props('to')).toBe('/applications/demo/web')
expect(pooled!.getComponent<typeof RouterLinkStub>('[data-application]').props('to')).toBe(
'/applications/demo/web'
)
expect(pooled!.get('[data-application]').text()).toBe('Demo / Web')
expect(pooled!.getComponent('[data-worker]').props('to')).toBe('/workers/w1')
expect(pooled!.getComponent<typeof RouterLinkStub>('[data-worker]').props('to')).toBe(
'/workers/w1'
)
expect(pooled!.get('[data-pool]').text()).toBe('eu')
expect(plain!.find('[data-pool]').exists()).toBe(false)
})
Expand All @@ -256,7 +260,9 @@ describe('the Domains page', () => {
await flushPromises()

expect(wrapper.find('[data-application]').exists()).toBe(false)
expect(wrapper.getComponent('[data-worker]').props('to')).toBe('/workers/w2')
expect(wrapper.getComponent<typeof RouterLinkStub>('[data-worker]').props('to')).toBe(
'/workers/w2'
)
})

it('opens an HTTP address and shows a TCP one as text', async () => {
Expand Down
1 change: 1 addition & 0 deletions ui/tests/pages/Home.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const summary: HomeSummary = {
stopping: 0,
backup: 0,
restoring: 0,
recovering: 0,
},
domains: { total: 4, synced: 1, pending: 1, syncing: 1, error: 1 },
deploys: { succeeded: 4, failed: 2 },
Expand Down
20 changes: 9 additions & 11 deletions ui/tests/pages/TaskTable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ describe('the task table', () => {
})

it("shows a finished task's status as an icon left of its id", () => {
const task = table(finished, 'finished').findAll('td')[0].get('div')
const task = table(finished, 'finished').get('td').get('div')
const [icon, id] = task.element.children
expect(icon.getAttribute('role')).toBe('img')
expect(icon.getAttribute('aria-label')).toBe('completed')
expect(id.tagName.toLowerCase()).toBe('task-logs-button-stub')
expect(icon!.getAttribute('role')).toBe('img')
expect(icon!.getAttribute('aria-label')).toBe('completed')
expect(id!.tagName.toLowerCase()).toBe('task-logs-button-stub')
expect(task.text()).toBe('')
})

Expand All @@ -90,17 +90,15 @@ describe('the task table', () => {
...finished,
finished_at: new Date(Date.parse(`${at(1)}Z`) + seconds * 1000).toISOString(),
}
expect(taskTimes(ran, 'finished').at(-1)).toEqual({
label: 'Ran',
value: shown,
duration: true,
})
expect(taskTimes(ran, 'finished').slice(-1)).toEqual([
{ label: 'Ran', value: shown, duration: true },
])
})

it('gives a running task how long it waited, and no run time', () => {
const times = taskTimes({ ...queued, started_at: at(3) }, 'running')
expect(times.map(time => time.label)).toEqual(['Queued', 'Started', 'Waited'])
expect(times.at(-1)!.value).toBe('3:00 mins')
expect(times[2]!.value).toBe('3:00 mins')
})

it("shows a running task's two dates in its row, without its wait", () => {
Expand All @@ -119,7 +117,7 @@ describe('the task table', () => {
const wrapper = table(queued, 'queued')
expect(pairs(queued, 'queued', 'times')).toEqual([['Queued', formatDate(at(0))]])
expect(wrapper.find('[data-durations]').exists()).toBe(false)
expect(wrapper.findAll('td')[0].text()).toBe('')
expect(wrapper.get('td').text()).toBe('')
})

it('shows each label with its value beside it', () => {
Expand Down
9 changes: 8 additions & 1 deletion ui/tests/stores/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ function onWorkers() {
}

function settings(state: SettingState = 'ok'): SettingsStatus {
const section = { state, message: null, task_id: null, checked_at: null, details: null }
const section = {
state,
message: null,
task_id: null,
checked_at: null,
details: null,
testing: false,
}
return {
tailscale: { ...section, channels: null },
cloudflare: { ...section, channels: null },
Expand Down