Skip to content

Commit

Permalink
chore: handle more cases where methods can be mocked
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Benoit <[email protected]>
  • Loading branch information
benoitf committed Dec 18, 2024
1 parent 40dab1a commit eca9082
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/renderer/src/TelemetryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class TelemetryService {

this.handlerFlusher = setTimeout(() => {
if (window.telemetryPage) {
window.telemetryPage(pagePath).catch((error: unknown) => {
window.telemetryPage(pagePath)?.catch((error: unknown) => {
console.error('Failed to send page event', error);
});
}
Expand Down
6 changes: 3 additions & 3 deletions packages/renderer/src/stores/appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export const isDark: Writable<boolean> = writable(false);
configurationProperties.subscribe(() => {
if (window?.getConfigurationValue) {
window
.getConfigurationValue<string>(AppearanceSettings.SectionName + '.' + AppearanceSettings.Appearance)
.then(value => {
?.getConfigurationValue<string>(AppearanceSettings.SectionName + '.' + AppearanceSettings.Appearance)
?.then(value => {
if (value) {
updateIsDark(value);
}
})
.catch((err: unknown) =>
?.catch((err: unknown) =>
console.error(
`Error getting configuration value ${AppearanceSettings.SectionName + '.' + AppearanceSettings.Appearance}`,
err,
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/src/stores/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function setup(): Writable<ContextUI> {
// this function can be undefined during tests
window
.contextCollectAllValues?.()
.then(values => {
?.then(values => {
const currentContext = Object.entries(values).reduce((result, [key, value]) => {
result.setValue(key, value);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ configurationProperties.subscribe(() => {
if (window.getConfigurationValue) {
window
.getConfigurationValue<string[]>('navbar.disabledItems')
.then(value => {
?.then(value => {
if (value) {
hiddenItems = value;
}
Expand Down

0 comments on commit eca9082

Please sign in to comment.