Add test for resolveQueryByLanguage

This commit is contained in:
shati-patel
2021-09-01 19:05:19 +01:00
committed by Shati Patel
parent 8151739f87
commit 6f16192865
2 changed files with 12 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
import javascript
predicate edges(int i, int j) {
i = 1 and j = 2 or i = 2 and j = 3
}

View File

@@ -1,8 +1,9 @@
import { expect } from 'chai';
import { extensions } from 'vscode';
import { extensions, Uri } from 'vscode';
import * as path from 'path';
import { SemVer } from 'semver';
import { CodeQLCliServer } from '../../cli';
import { CodeQLCliServer, QueryInfoByLanguage } from '../../cli';
import { CodeQLExtensionInterface } from '../../extension';
import { skipIfNoCodeQL } from '../ensureCli';
import { getOnDiskWorkspaceFolders } from '../../helpers';
@@ -60,4 +61,11 @@ describe('Use cli', function() {
expect(languages).to.have.property(expectedLanguage).that.is.not.undefined;
}
});
it('should resolve query by language', async function() {
skipIfNoCodeQL(this);
const queryPath = path.join(__dirname, 'data', 'simple-query.ql');
const queryInfo: QueryInfoByLanguage = await cli.resolveQueryByLanguage(getOnDiskWorkspaceFolders(), Uri.file(queryPath));
expect((Object.keys(queryInfo.byLanguage))[0]).to.eql('javascript');
});
});