|
1 | 1 | import * as assert from 'assert'; |
2 | | -import {getRegisteredTutorials, getDidactCategories, getTutorialsForCategory, getUriForDidactNameAndCategory, registerTutorialWithCategory, clearRegisteredTutorials, registerTutorialWithArgs, setAppendRegisteredSetting, getAppendRegisteredSetting, appendAdditionalTutorials} from '../../utils'; |
| 2 | +import {getRegisteredTutorials, getDidactCategories, getTutorialsForCategory, getUriForDidactNameAndCategory, registerTutorialWithCategory, clearRegisteredTutorials, registerTutorialWithArgs, DIDACT_APPEND_REGISTERED_SETTING, getAppendRegisteredSettingFromEnv, appendAdditionalTutorialsFromEnv} 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,22 +115,22 @@ suite('Didact registry test suite', () => { |
115 | 115 | assert.ok(foundTutorial, `Did not find new-tutorial-4 registered via JSON`); |
116 | 116 | }); |
117 | 117 |
|
| 118 | + test('append registry from environment variable', async() => { |
| 119 | + const tutsToAppend : String = '[{"name":"AppendMe2","category":"AppendedCat2","sourceUri":"https%3A%2F%2Fraw.githubusercontent.com%2Fredhat-developer%2Fvscode-didact%2Fmaster%2Fexamples%2Fregistry.example.didact.md"}]'; |
| 120 | + getContext().environmentVariableCollection.append(DIDACT_APPEND_REGISTERED_SETTING, tutsToAppend.toString()); |
| 121 | + |
| 122 | + const envVarJson = getAppendRegisteredSettingFromEnv(); |
| 123 | + console.log(`envVar = ` + envVarJson); |
| 124 | + assert.ok(envVarJson, `Did not find envVarJson`); |
118 | 125 |
|
119 | | - test('append to registry', async() => { |
120 | 126 | const registry = getRegisteredTutorials(); |
121 | 127 | assert.notStrictEqual(registry, undefined); |
122 | 128 |
|
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(); |
| 129 | + const tutName = `AppendMe2`; |
| 130 | + await appendAdditionalTutorialsFromEnv(); |
131 | 131 | const foundTutorial = verifyTutorialInRegistry(tutName); |
132 | 132 | assert.ok(foundTutorial, `Did not find ${tutName} registered after appending to tutorial list from settings`); |
133 | | - }); |
| 133 | + }); |
134 | 134 |
|
135 | 135 | test('Clear all the tutorials', async() => { |
136 | 136 | const registry = getRegisteredTutorials(); |
|
0 commit comments