Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #499 from IEvangelist/unitTests
Added unit tests for utility functions that I wrote
- Loading branch information
Showing
3 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
import * as assert from 'assert'; | ||
import * as assert from "assert"; | ||
|
||
// You can import and use all API from the 'vscode' module | ||
// as well as import your extension to test it | ||
import { installedExtensionsCheck, deactivate } from '../../extension'; | ||
import { window } from 'vscode'; | ||
import { window } from "vscode"; | ||
import { deactivate, installedExtensionsCheck } from "../../extension"; | ||
|
||
suite('Extension Test Suite', () => { | ||
window.showInformationMessage('Start all tests.'); | ||
suite("Extension Test Suite", () => { | ||
window.showInformationMessage("Start all tests."); | ||
|
||
test('Sample test', () => { | ||
test("Sample test", () => { | ||
deactivate(); | ||
|
||
installedExtensionsCheck(); | ||
|
||
assert.equal(-1, [1, 2, 3].indexOf(5)); | ||
assert.equal(-1, [1, 2, 3].indexOf(0)); | ||
|
||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as chai from "chai"; | ||
import * as utility from "../../../helper/utility"; | ||
|
||
const expect = chai.expect; | ||
|
||
suite("Utility helper class", () => { | ||
test("inferLanguageFromFileExtension returns null when not found", () => { | ||
const lang = utility.inferLanguageFromFileExtension(".foobar"); | ||
expect(lang).to.be.equal(null); | ||
}); | ||
|
||
test("inferLanguageFromFileExtension returns correct language when found", () => { | ||
const lang = utility.inferLanguageFromFileExtension(".ts"); | ||
expect(lang ? lang.language : "").to.be.equal("TypeScript"); | ||
}); | ||
}); |