Files
azuredatastudio/extensions/data-workspace/src/test/utils.test.ts
Benjin Dubishar c903cd87bf Telemetry for Data Workspaces extension (#13846)
* Add CodeQL Analysis workflow (#10195)

* Add CodeQL Analysis workflow

* Fix path

* test commit pls ignore

* telemetry points

* yarn lock changes

* making test xplat friendly

* PR feedback

* Adding additional telemetry points

Co-authored-by: Justin Hutchings <jhutchings1@users.noreply.github.com>
2021-01-22 14:18:43 -08:00

22 lines
1.1 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'mocha';
import * as os from 'os';
import * as path from 'path';
import should = require('should');
import { calculateRelativity } from '../common/telemetry';
suite('Utilities Tests', function (): void {
test('test CalculateRelativity', async () => {
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
const workspacePath = path.join(root, 'Source', 'Workspace', 'qwerty.code-workspace');
should.equal(calculateRelativity(path.join(root, 'Source', 'Workspace', 'qwerty.sqlproj'), workspacePath), 'sameFolder');
should.equal(calculateRelativity(path.join(root, 'Source', 'Workspace', 'qwerty', 'asdfg', 'qwerty.sqlproj'), workspacePath), 'directAncestor');
should.equal(calculateRelativity(path.join(root, 'Users', 'BillG', 'qwerty.sqlproj'), workspacePath), 'other');
});
});