Skip to content

Commit d92ed41

Browse files
committed
Add test
1 parent 1f87aab commit d92ed41

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/gatsby-remark-vscode.test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,41 @@ describe('extension downloading', () => {
170170
expect(requestMock).toHaveBeenCalledTimes(2);
171171
expect(decompressMock).toHaveBeenCalledTimes(2);
172172
});
173+
174+
it('can download an extension to a custom location', async () => {
175+
const plugin = createPlugin();
176+
// @ts-ignore
177+
const requestMock = request.get.mockImplementation((_, __, cb) => {
178+
cb(null, { statusCode: 200, headers: {} }, Buffer.from(''));
179+
});
180+
// @ts-ignore
181+
const decompressMock = decompress.mockImplementation(jest.fn());
182+
// @ts-ignore
183+
utils.requireJson.mockImplementation(() => ({
184+
contributes: {
185+
languages: [{
186+
id: 'custom',
187+
}],
188+
grammars: [{
189+
language: 'custom',
190+
scopeName: 'source.custom',
191+
path: `../../../../../../custom.tmLanguage.json`
192+
}],
193+
}
194+
}));
195+
196+
return plugin({
197+
markdownAST: createMarkdownAST('custom'),
198+
markdownNode,
199+
cache: createCache(),
200+
}, {
201+
extensionDataDirectory: path.resolve(__dirname, 'extensions/one/two/three'),
202+
extensions: [{
203+
identifier: 'publisher.custom-language',
204+
version: '1.0.0',
205+
}],
206+
});
207+
});
173208
});
174209

175210
it('sets highlighted line class names', async () => {

0 commit comments

Comments
 (0)