|
1 | 1 | import * as assert from 'assert'; |
2 | | -import {getRegisteredTutorials, getDidactCategories, getTutorialsForCategory, getUriForDidactNameAndCategory, registerTutorialWithCategory, clearRegisteredTutorials, registerTutorialWithArgs} from '../../utils'; |
| 2 | +import {getRegisteredTutorials, getDidactCategories, getTutorialsForCategory, getUriForDidactNameAndCategory, registerTutorialWithCategory, clearRegisteredTutorials, registerTutorialWithArgs, setAppendRegisteredSetting, getAppendRegisteredSetting, appendAdditionalTutorials} from '../../utils'; |
3 | 3 | import {before} from 'mocha'; |
4 | 4 | import * as vscode from 'vscode'; |
5 | 5 | import { ADD_TUTORIAL_TO_REGISTRY, getContext, REGISTER_TUTORIAL } from '../../extensionFunctions'; |
@@ -115,6 +115,23 @@ suite('Didact registry test suite', () => { |
115 | 115 | assert.ok(foundTutorial, `Did not find new-tutorial-4 registered via JSON`); |
116 | 116 | }); |
117 | 117 |
|
| 118 | + |
| 119 | + test('append to registry', async() => { |
| 120 | + const registry = getRegisteredTutorials(); |
| 121 | + assert.notStrictEqual(registry, undefined); |
| 122 | + |
| 123 | + const tutName = `AppendMe`; |
| 124 | + const tutsToAppend : String = '[{"name":"AppendMe","category":"AppendedCat","sourceUri":"https%3A%2F%2Fraw.githubusercontent.com%2Fredhat-developer%2Fvscode-didact%2Fmaster%2Fexamples%2Fregistry.example.didact.md"}]'; |
| 125 | + await setAppendRegisteredSetting(tutsToAppend); |
| 126 | + |
| 127 | + const appendToRegistry = getAppendRegisteredSetting(); |
| 128 | + assert.notStrictEqual(appendToRegistry, undefined); |
| 129 | + |
| 130 | + await appendAdditionalTutorials(); |
| 131 | + const foundTutorial = verifyTutorialInRegistry(tutName); |
| 132 | + assert.ok(foundTutorial, `Did not find ${tutName} registered after appending to tutorial list from settings`); |
| 133 | + }); |
| 134 | + |
118 | 135 | test('Clear all the tutorials', async() => { |
119 | 136 | const registry = getRegisteredTutorials(); |
120 | 137 | assert.notStrictEqual(registry, undefined); |
|
0 commit comments