Skip to content

Commit

Permalink
fix: integration test for next version
Browse files Browse the repository at this point in the history
  • Loading branch information
marabesi committed Dec 12, 2021
1 parent aa382d7 commit 660eec7
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions test/integration/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,42 @@ import * as myExtension from '../../src/extension';
const testFolderLocation = '/../../../test/examples/'

suite('php-import-checker extension behavior', () => {
suite('handle php with valid syntax', () => {
[
...dataProvider,
].forEach((testCase) => {
test('Should identify when there is no used class in a text, snippet:::' + testCase.snippet, async () => {
const uri = vscode.Uri.file(
path.join(__dirname + testFolderLocation + testCase.snippet)
);

[
...dataProvider,
...dataProviderNextVersion,
].forEach((testCase) => {
test('Should identify when there is no used class in a text, snippet:::' + testCase.snippet, async () => {
const uri = vscode.Uri.file(
path.join(__dirname + testFolderLocation + testCase.snippet)
);
const document = await vscode.workspace.openTextDocument(uri);
const editor = await vscode.window.showTextDocument(document);

const document = await vscode.workspace.openTextDocument(uri);
const editor = await vscode.window.showTextDocument(document);
const found = myExtension.findMatch(editor, editor.document.getText(), {});

const found = myExtension.findMatch(editor, editor.document.getText(), {});
assert.equal(testCase.unused, found.length);
});
});
});

suite('use_next_version: handle php with valid syntax', () => {
[
...dataProvider,
...dataProviderNextVersion,
].forEach((testCase) => {
test('snippet:::' + testCase.snippet, async () => {
const uri = vscode.Uri.file(
path.join(__dirname + testFolderLocation + testCase.snippet)
);

const document = await vscode.workspace.openTextDocument(uri);
const editor = await vscode.window.showTextDocument(document);

const found = myExtension.findMatch(editor, editor.document.getText(), { use_next_version: true });

assert.equal(testCase.unused, found.length);
assert.equal(testCase.unused, found.length);
});
});
});
});

0 comments on commit 660eec7

Please sign in to comment.