Skip to content

Commit 9c2821a

Browse files
committed
Unit tests for getQueryText
1 parent 93a6f50 commit 9c2821a

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

extensions/ql-vscode/test/pure-tests/query-history-info.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from 'chai';
22

33
import { QueryStatus } from '../../src/query-status';
4-
import { getQueryHistoryItemId, getRawQueryName } from '../../src/query-history-info';
4+
import { getQueryHistoryItemId, getQueryText, getRawQueryName } from '../../src/query-history-info';
55
import { VariantAnalysisHistoryItem } from '../../src/remote-queries/variant-analysis-history-item';
66
import { createMockVariantAnalysis } from '../../src/vscode-tests/factories/remote-queries/shared/variant-analysis';
77
import { createMockLocalQueryInfo } from '../../src/vscode-tests/factories/local-queries/local-query-history-item';
@@ -60,4 +60,24 @@ describe('Query history info', () => {
6060
expect(historyItemId).to.equal(variantAnalysisHistoryItem.historyItemId);
6161
});
6262
});
63+
64+
describe('getQueryText', () => {
65+
it('should get the query text for local history items', () => {
66+
const queryText = getQueryText(localQueryHistoryItem);
67+
68+
expect(queryText).to.equal(localQueryHistoryItem.initialInfo.queryText);
69+
});
70+
71+
it('should get the query text for remote query history items', () => {
72+
const queryText = getQueryText(remoteQueryHistoryItem);
73+
74+
expect(queryText).to.equal(remoteQueryHistoryItem.remoteQuery.queryText);
75+
});
76+
77+
it('should get the query text for variant analysis history items', () => {
78+
const queryText = getQueryText(variantAnalysisHistoryItem);
79+
80+
expect(queryText).to.equal(variantAnalysisHistoryItem.variantAnalysis.query.text);
81+
});
82+
});
6383
});

0 commit comments

Comments
 (0)