提交 ce10ecf6 编写于 作者: K Kev

test: add tests for review/review_uri

上级 a85efec4
......@@ -12,9 +12,9 @@ module.exports = {
Uri: {
file: path => ({
path,
with: (...args) => ({
with: args => ({
path,
args,
...args,
}),
}),
parse: str => str,
......
import * as vscode from 'vscode';
import { fromReviewUri, toReviewUri } from './review_uri';
jest.mock('vscode');
describe('review_uri.ts', () => {
const uri = {
path: '/review',
query: '{"commit":"abcdef","workspacePath":"https://gitlab-example.com/test","projectId":1234}',
scheme: 'gl-review',
};
const params = {
commit: 'abcdef',
path: '/review',
projectId: 1234,
workspacePath: 'https://gitlab-example.com/test',
};
describe('toReviewUri', () => {
it('returns the correct Uri', () => {
const result = toReviewUri(params);
expect(result).toEqual(uri);
});
});
describe('fromReviewUri', () => {
it('returns the correct string', () => {
const result = fromReviewUri(uri as vscode.Uri);
expect(result).toEqual(params);
});
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册