Skip to content

Commit 4424231

Browse files
authored
Merge pull request #331 from redhat-developer/multiple-contributor-error
Re-add multiple contributors error test
2 parents e6420dc + 7ea7a8d commit 4424231

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/schemaProvider.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,23 @@ describe('Tests for schema provider feature', () => {
134134
}
135135
]
136136
});
137+
});
138+
139+
it('Multiple contributors with one throwing an error', async () => {
140+
const client = await activate(docUri);
141+
client._customSchemaContributors = {};
142+
client.registerContributor(SCHEMA2, onRequestSchema2URI, onRequestSchema2Content);
143+
client.registerContributor("schemathrowingerror", onRequestSchemaURIThrowError, onRequestSchemaContentThrowError);
144+
145+
await testCompletion(docUri, new vscode.Position(0, 0), {
146+
items: [
147+
{
148+
label: "apple",
149+
kind: 9,
150+
documentation: "An apple"
151+
}
152+
]
153+
});
137154
});
138155
});
139156

@@ -165,6 +182,14 @@ function onRequestSchema1Content(schemaUri: string): string | undefined {
165182
return schemaJSON;
166183
}
167184

185+
function onRequestSchemaURIThrowError(resource: string): string | undefined {
186+
throw new Error('test what happens when an error is thrown and not caught');
187+
}
188+
189+
function onRequestSchemaContentThrowError(schemaUri: string): string | undefined {
190+
throw new Error('test what happens when an error is thrown and not caught');
191+
}
192+
168193
const schemaJSON2 = JSON.stringify({
169194
"type": "object",
170195
"properties": {

0 commit comments

Comments
 (0)