-
-
Notifications
You must be signed in to change notification settings - Fork 370
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 #168 from tonybaloney/more_integration_testing
- Loading branch information
Showing
16 changed files
with
3,866 additions
and
362 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,15 @@ jobs: | |
- run: npm ci | ||
- run: npm run compile | ||
- run: npm run lint | ||
- name: Run unit and integration tests | ||
uses: GabrielBB/[email protected] | ||
with: | ||
run: npm run test | ||
- name: Run coverage | ||
uses: GabrielBB/[email protected] | ||
continue-on-error: true | ||
with: | ||
run: npm run test:coverage | ||
# - uses: codecov/codecov-action@v3 | ||
# with: | ||
# directory: ./coverage |
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 |
---|---|---|
|
@@ -3,4 +3,6 @@ dist | |
node_modules | ||
.vscode-test/ | ||
*.vsix | ||
.build-out/ | ||
.build-out/ | ||
coverage/ | ||
.nyc_output/ |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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,64 @@ | ||
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 * as vscode from 'vscode'; | ||
import { PetSize, PetType, PetColor } from '../../common/types'; | ||
import * as pets from '../../panel/pets'; | ||
|
||
import { JSDOM } from 'jsdom'; | ||
|
||
declare global { | ||
namespace NodeJS { | ||
interface Global { | ||
document: Document; | ||
} | ||
} | ||
} | ||
|
||
const { window } = new JSDOM('<!doctype html><html><body></body></html>'); | ||
global.document = window.document; | ||
|
||
suite('Pets Test Suite', () => { | ||
vscode.window.showInformationMessage('Start all tests.'); | ||
|
||
test('Test pet collection', () => { | ||
var collection = new pets.PetCollection(); | ||
const petImageEl = global.document.createElement( | ||
'image', | ||
) as HTMLImageElement; | ||
const petDivEl = global.document.createElement('div') as HTMLDivElement; | ||
const testPet = pets.createPet( | ||
'cat', | ||
petImageEl, | ||
petDivEl, | ||
PetSize.medium, | ||
0, | ||
0, | ||
'testPet', | ||
0, | ||
'Jerry', | ||
); | ||
assert.ok(testPet instanceof pets.Cat); | ||
assert.equal(testPet.emoji(), '🐱'); | ||
assert.equal(testPet.name(), 'Jerry'); | ||
|
||
const testPetElement = new pets.PetElement( | ||
petImageEl, | ||
petDivEl, | ||
testPet, | ||
PetColor.brown, | ||
PetType.cat, | ||
); | ||
assert.strictEqual(testPetElement.color, PetColor.brown); | ||
assert.strictEqual(testPetElement.type, PetType.cat); | ||
|
||
assert.strictEqual(collection.locate('Jerry'), undefined); | ||
|
||
collection.push(testPetElement); | ||
assert.strictEqual(collection.locate('Jerry'), testPetElement); | ||
|
||
collection.remove('Jerry'); | ||
assert.strictEqual(collection.locate('Jerry'), undefined); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -18,5 +18,6 @@ | |
"node_modules", | ||
".vscode-test", | ||
"src/panel", | ||
"src/test" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"exclude": [ | ||
"node_modules", | ||
".vscode-test", | ||
"src/extension" | ||
"src/extension", | ||
"src/test" | ||
] | ||
} |
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,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "esnext", | ||
"outDir": "out", | ||
"lib": [ | ||
"es6", "DOM" | ||
], | ||
"sourceMap": true, | ||
"rootDirs": ["panel", "common", "test", "extension"], | ||
"strict": true /* enable all strict type-checking options */ | ||
/* Additional Checks */ | ||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ | ||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ | ||
// "noUnusedParameters": true, /* Report errors on unused parameters. */ | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
] | ||
} |