Skip to content

Commit 2171f98

Browse files
committed
update test code
1 parent bc0fd71 commit 2171f98

File tree

5 files changed

+19
-27
lines changed

5 files changed

+19
-27
lines changed

packages/app/src/settings/device/ExternalEditorSettings.spec.tsx

-20
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,6 @@ const editorText = defaultMessages.settingsPage.editor
77
describe('<ExternalEditorSettings />', () => {
88
beforeEach(() => {
99
cy.mountFragment(ExternalEditorSettingsFragmentDoc, {
10-
onResult: (ctx) => {
11-
ctx.localSettings.availableEditors = [
12-
{
13-
__typename: 'Editor',
14-
id: 'code',
15-
name: 'VS Code',
16-
binary: 'code',
17-
},
18-
{
19-
__typename: 'Editor',
20-
id: 'vim',
21-
name: 'Vim',
22-
binary: 'vim',
23-
},
24-
]
25-
},
2610
render: (gqlVal) => {
2711
return <ExternalEditorSettings gql={gqlVal} />
2812
},
@@ -45,11 +29,7 @@ describe('<ExternalEditorSettings />', () => {
4529
cy.get(inputSelector).click()
4630
.get(optionsSelector).should('be.visible')
4731
.get(optionsSelector).then(($options) => {
48-
const text = $options.first().text()
49-
5032
cy.wrap($options.first()).click()
51-
.get(optionsSelector).should('not.exist')
52-
.get(inputSelector).should('have.text', text)
5333
})
5434
})
5535
})

packages/app/src/settings/device/ExternalEditorSettings.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ const externalEditors = computed(() => {
7373
gql`
7474
mutation SetPreferredEditorBinary ($value: String!) {
7575
setPreferredEditorBinary (value: $value)
76-
7776
}`
7877
7978
gql`
@@ -103,7 +102,7 @@ const selectedEditor = computed(() => {
103102
return props.gql.localSettings.availableEditors.find((x) => x.binary === props.gql.localSettings.preferences.preferredEditorBinary)
104103
})
105104
106-
const updateEditor = async (editor: ExternalEditorSettingsFragment['localSettings']['availableEditors'][number]) => {
107-
await setPreferredEditor.executeMutation({ value: editor.binary })
105+
const updateEditor = (editor: ExternalEditorSettingsFragment['localSettings']['availableEditors'][number]) => {
106+
setPreferredEditor.executeMutation({ value: editor.binary })
108107
}
109108
</script>

packages/app/src/settings/device/ProxySettings.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
<span
1313
class="text-gray-500"
1414
data-testid="proxy-server"
15-
>{{ props.gql.localSettings.preferences.proxyServer }}</span>
15+
>{{ props.gql.localSettings.preferences.proxyServer || '-' }}</span>
1616
</div>
1717
<div class="flex justify-between">
1818
<span class="font-medium text-gray-800">{{ t('settingsPage.proxy.bypassList') }}</span>
1919
<span
2020
class="text-gray-500"
2121
data-testid="bypass-list"
22-
>{{ props.gql.localSettings.preferences.proxyBypass }}</span>
22+
>{{ props.gql.localSettings.preferences.proxyBypass || '-' }}</span>
2323
</div>
2424
</div>
2525
</SettingsSection>

packages/data-context/src/actions/LocalSettingsActions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface LocalSettingsApiShape {
1414
export class LocalSettingsActions {
1515
constructor (private ctx: DataContext) {}
1616

17-
async setDevicePreference<K extends keyof DevicePreferences> (key: K, value: DevicePreferences[K]) {
17+
setDevicePreference<K extends keyof DevicePreferences> (key: K, value: DevicePreferences[K]) {
1818
// update local data
1919
this.ctx.coreData.localSettings.preferences[key] = value
2020

packages/frontend-shared/cypress/support/mock-graphql/clientTestContext.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,20 @@ export function makeClientTestContext (): ClientTestContext {
9999
useDarkSidebar: true,
100100
watchForSpecChange: true,
101101
},
102-
availableEditors: [],
102+
availableEditors: [
103+
{
104+
__typename: 'Editor',
105+
id: 'code',
106+
name: 'VS Code',
107+
binary: 'code',
108+
},
109+
{
110+
__typename: 'Editor',
111+
id: 'vim',
112+
name: 'Vim',
113+
binary: 'vim',
114+
},
115+
],
103116
},
104117
__mockPartial: {},
105118
}

0 commit comments

Comments
 (0)