Unit tests for getQueryText

This commit is contained in:
shati-patel
2022-10-18 14:55:13 +01:00
committed by Shati Patel
parent 93a6f50c0e
commit 9c2821a418

View File

@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { QueryStatus } from '../../src/query-status';
import { getQueryHistoryItemId, getRawQueryName } from '../../src/query-history-info';
import { getQueryHistoryItemId, getQueryText, getRawQueryName } from '../../src/query-history-info';
import { VariantAnalysisHistoryItem } from '../../src/remote-queries/variant-analysis-history-item';
import { createMockVariantAnalysis } from '../../src/vscode-tests/factories/remote-queries/shared/variant-analysis';
import { createMockLocalQueryInfo } from '../../src/vscode-tests/factories/local-queries/local-query-history-item';
@@ -60,4 +60,24 @@ describe('Query history info', () => {
expect(historyItemId).to.equal(variantAnalysisHistoryItem.historyItemId);
});
});
describe('getQueryText', () => {
it('should get the query text for local history items', () => {
const queryText = getQueryText(localQueryHistoryItem);
expect(queryText).to.equal(localQueryHistoryItem.initialInfo.queryText);
});
it('should get the query text for remote query history items', () => {
const queryText = getQueryText(remoteQueryHistoryItem);
expect(queryText).to.equal(remoteQueryHistoryItem.remoteQuery.queryText);
});
it('should get the query text for variant analysis history items', () => {
const queryText = getQueryText(variantAnalysisHistoryItem);
expect(queryText).to.equal(variantAnalysisHistoryItem.variantAnalysis.query.text);
});
});
});