Skip to content

Commit 8cfa82f

Browse files
committed
Move query-history-info tests next to query-history tests
We've introduced a new `local-query-history-item.ts` factory method [1] which includes a cancellation token. The factory will need to import the CancellationTokenSource from `vscode`. We already had a factory method but it didn't quite map with the setup we needed. For example we need to call `.completeQuery` rather than providing a dummy `completedQuery` object. The previous factory method was used in the tests for `query-history-info.test.ts`. Because that factory omitted the cancellation token, we could get away with having these tests in the `tests/pure-tests` folder. With the addition of the second factory method, the tests for `query-history-info` blow up because they can't find `vscode`. Now that we need to add more fields to local query history items, it's becoming clearer that these `query-history-info` tests should live next to the `query-history` tests in `vscode-tests/no-workspace`. Granted, in an ideal situation we'd only have one factory method to generate a local query history item, but combining these two methods is actually quite painful. So for now let's at least have the query history tests next to each other and appease Typescript.
1 parent 99af9ca commit 8cfa82f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

extensions/ql-vscode/test/pure-tests/query-history-info.test.ts renamed to extensions/ql-vscode/src/vscode-tests/no-workspace/query-history-info.test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import { expect } from 'chai';
2-
3-
import { QueryStatus } from '../../src/query-status';
2+
import { QueryStatus } from '../../query-status';
43
import {
54
buildRepoLabel,
65
getActionsWorkflowRunUrl,
76
getQueryId,
87
getQueryText,
98
getRawQueryName
10-
} from '../../src/query-history-info';
11-
import { VariantAnalysisHistoryItem } from '../../src/remote-queries/variant-analysis-history-item';
12-
import { createMockVariantAnalysis } from '../../src/vscode-tests/factories/remote-queries/shared/variant-analysis';
13-
import { createMockScannedRepos } from '../../src/vscode-tests/factories/remote-queries/shared/scanned-repositories';
14-
import { createMockLocalQueryInfo } from '../../src/vscode-tests/factories/local-queries/local-query-history-item';
15-
import { createMockRemoteQueryHistoryItem } from '../../src/vscode-tests/factories/remote-queries/remote-query-history-item';
16-
import { VariantAnalysisRepoStatus, VariantAnalysisStatus } from '../../src/remote-queries/shared/variant-analysis';
9+
} from '../../query-history-info';
10+
import { VariantAnalysisHistoryItem } from '../../remote-queries/variant-analysis-history-item';
11+
import { createMockVariantAnalysis } from '../factories/remote-queries/shared/variant-analysis';
12+
import { createMockScannedRepos } from '../factories/remote-queries/shared/scanned-repositories';
13+
import { createMockLocalQueryInfo } from '../factories/local-queries/local-query-history-item';
14+
import { createMockRemoteQueryHistoryItem } from '../factories/remote-queries/remote-query-history-item';
15+
import { VariantAnalysisRepoStatus, VariantAnalysisStatus } from '../../remote-queries/shared/variant-analysis';
1716

1817
describe('Query history info', () => {
1918

0 commit comments

Comments
 (0)