-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathCanisterCallForm.spec.ts
More file actions
57 lines (47 loc) · 1.59 KB
/
CanisterCallForm.spec.ts
File metadata and controls
57 lines (47 loc) · 1.59 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
50
51
52
53
54
55
56
57
import { Principal } from '@icp-sdk/core/principal';
import { describe, expect, it } from 'vitest';
import { mount } from '~/test.utils';
import CanisterCallForm from './CanisterCallForm.vue';
describe('CanisterCallForm', () => {
it('renders form with method_name filled', () => {
const canisterId = Principal.fromText('r7inp-6aaaa-aaaaa-aaabq-cai');
const form = mount(CanisterCallForm, {
props: {
modelValue: {
methodName: 'test',
canisterId,
},
},
});
const methodNameInput = form.find('[name="method_name"]');
expect(methodNameInput.exists()).toBe(true);
expect(methodNameInput.element.getAttribute('value')).toBe('test');
});
it('opening expansion panel shows attach cycles option', async () => {
const canisterId = Principal.fromText('r7inp-6aaaa-aaaaa-aaabq-cai');
const form = mount(CanisterCallForm, {
props: {
modelValue: {
methodName: 'test',
canisterId,
},
},
});
await form.find('button.v-expansion-panel-title').trigger('click');
const cyclesInput = form.find('[name="cycles"]');
expect(cyclesInput.exists()).toBe(true);
});
it('default is to hide advanced settings and not show cycles input', async () => {
const canisterId = Principal.fromText('r7inp-6aaaa-aaaaa-aaabq-cai');
const form = mount(CanisterCallForm, {
props: {
modelValue: {
methodName: 'test',
canisterId,
},
},
});
const cyclesInput = form.find('[name="cycles"]');
expect(cyclesInput.exists()).toBe(false);
});
});