This repository was archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
/
Copy pathcommands.test.ts
131 lines (115 loc) · 4.37 KB
/
commands.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
// Note: This example test is leveraging the Mocha test framework.
// Please refer to their documentation on https://mochajs.org/ for help.
//
import * as assert from "assert";
import * as vscode from "vscode";
// Defines a Mocha test suite to group tests of similar kind together
suite("Arduino: Commands Tests", () => {
// tslint:disable-next-line: only-arrow-functions
setup(function(done) {
// Ensure that extension is activate while testing
this.timeout(60 * 1000);
const extension = vscode.extensions.getExtension("vsciot-vscode.vscode-arduino");
if (!extension.isActive) {
extension.activate().then((api) => {
done();
}, () => {
done("Failed to activate extension");
});
} else {
done();
}
});
// Arduino: Initialize:Scaffold a VS Code project with an Arduino sketch.
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.initialize", function(done) {
this.timeout(60 * 1000);
try {
// run "Arduino: Boards Manager" command.
vscode.commands.executeCommand("arduino.initialize").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Library Manager: Add library to include path.
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.addLibPath", function(done) {
this.timeout(60 * 1000);
try {
// Library Manager: Add library to include path.
vscode.commands.executeCommand("arduino.addLibPath", "#include <AzureIoTHub.h>").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Boards Manager : Manage packages for boards
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showBoardManager", function(done) {
this.timeout(60 * 1000);
try {
// run "Arduino: Boards Manager" command.
vscode.commands.executeCommand("arduino.showBoardManager").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Libraries Manager: Explore and manage libraries
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showLibraryManager", function(done) {
this.timeout(10 * 1000);
try {
// run "Arduino: Libraries Manager" command.
vscode.commands.executeCommand("arduino.showLibraryManager").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Arduino Board Configuration
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showBoardConfig", function(done) {
this.timeout(10 * 1000);
try {
// run "Arduino: Arduino Board Configuration" command.
vscode.commands.executeCommand("arduino.showBoardConfig").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Examples: Show example list
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showExamples", function(done) {
this.timeout(10 * 1000);
try {
// run "Arduino: Examples" command.
vscode.commands.executeCommand("arduino.showExamples").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino exportCompiledBinary", function(done) {
// Same timeout as verify, being the longest part of the command
this.timeout(3 * 60 * 1000);
try {
// run "Arduino: Export Compiled Binary" command.
vscode.commands.executeCommand("arduino.exportCompiledBinary").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
});