Skip to content
This repository was archived by the owner on May 11, 2022. It is now read-only.

Commit 31c3798

Browse files
committed
add test
Signed-off-by: Brian Fitzpatrick <[email protected]>
1 parent 253a05a commit 31c3798

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/test/suite/registry.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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';
33
import {before} from 'mocha';
44
import * as vscode from 'vscode';
55
import { ADD_TUTORIAL_TO_REGISTRY, getContext, REGISTER_TUTORIAL } from '../../extensionFunctions';
@@ -115,6 +115,23 @@ suite('Didact registry test suite', () => {
115115
assert.ok(foundTutorial, `Did not find new-tutorial-4 registered via JSON`);
116116
});
117117

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+
118135
test('Clear all the tutorials', async() => {
119136
const registry = getRegisteredTutorials();
120137
assert.notStrictEqual(registry, undefined);

0 commit comments

Comments
 (0)