Skip to content

Commit

Permalink
test: update mock
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu committed Dec 24, 2024
1 parent a0a37da commit dbe12b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function testDefaultSettings(
expectedOptions: Record<string, string>
) {
const settingsController = new CardOptionsController(new FakeSettingsService());
const defaultOptions = settingsController.getDefaultSettingsCardOptions(type);
const defaultOptions = settingsController.getDefaultCardOptions(type);
expect(defaultOptions).toStrictEqual(expectedOptions);
}

Expand All @@ -41,7 +41,7 @@ describe('SettingsController', () => {
avocado: 'false',
tags: 'false',
cloze: 'true',
'markdown-nested-bullet-points': 'false',
'markdown-nested-bullet-points': 'true',
'enable-input': 'false',
'basic-reversed': 'false',
reversed: 'false',
Expand Down Expand Up @@ -73,6 +73,7 @@ describe('SettingsController', () => {
'perserve-newlines': 'false',
'page-emoji': 'first-emoji',
'image-quiz-html-to-anki': 'false',
'markdown-nested-bullet-points': 'true',
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class CardOptionsController {
}
}

getDefaultSettingsCardOptions(source: 'client' | 'server') {
getDefaultCardOptions(source: 'client' | 'server') {
if (source === 'client') {
return this.getDefaultOptions()
return this.getDefaultCardOptionDetails()
.map((option: CardOptionDetail) => {
return { [option.key]: option.value.toString() };
})
Expand All @@ -70,7 +70,7 @@ class CardOptionsController {
return CardOption.LoadDefaultOptions();
}

getDefaultOptions() {
getDefaultCardOptionDetails() {
return supportedOptions();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/SettingsRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ const SettingsRouter = () => {
controller.findSetting(req, res)
);
router.get('/api/settings/default', (_req, res) => {
const defaultOptions = controller.getDefaultSettingsCardOptions('client');
const defaultOptions = controller.getDefaultCardOptions('client');
res.json(defaultOptions);
});

router.get('/api/settings/card-options', (_req, res) => {
const defaultOptions = controller.getDefaultOptions();
const defaultOptions = controller.getDefaultCardOptionDetails();
res.json(defaultOptions);
});

Expand Down

0 comments on commit dbe12b8

Please sign in to comment.