Skip to content

Commit 45efb68

Browse files
committed
test: add basic stupid tests that all check for true
1 parent 90458b9 commit 45efb68

3 files changed

Lines changed: 38 additions & 6 deletions

File tree

EnvironmentalOptions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
/**
1616
* Returns whether the current runtime is a mobile one (true) or not (false).
1717
*
18-
* @private
18+
* @public
1919
* @returns {Promise<bool>}
2020
*/
21-
async function isMobile() {
21+
export async function isMobile() {
2222
const platformInfo = await browser.runtime.getPlatformInfo();
2323

2424
return platformInfo.os === "android";
@@ -29,10 +29,10 @@ async function isMobile() {
2929
*
3030
* This includes Firefox and Thunderbird e.g.
3131
*
32-
* @private
32+
* @public
3333
* @returns {Promise<bool>}
3434
*/
35-
async function isMozilla() {
35+
export async function isMozilla() {
3636
const browserInfo = await browser.runtime.getBrowserInfo();
3737

3838
// Thunderbird is explicitly checked as a workaround as Thunderbird does not return the vendor correctly
@@ -46,10 +46,10 @@ async function isMozilla() {
4646
*
4747
* This does not include Thunderbird!
4848
*
49-
* @private
49+
* @public
5050
* @returns {Promise<bool>}
5151
*/
52-
async function isFirefox() {
52+
export async function isFirefox() {
5353
const browserInfo = await browser.runtime.getBrowserInfo();
5454

5555
return browserInfo.name === "Firefox";

tests/environmentalOptions.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import "https://unpkg.com/mocha@5.2.0/mocha.js"; /* globals mocha */
2+
import "https://unpkg.com/chai@4.1.2/chai.js"; /* globals chai */
3+
import "https://unpkg.com/sinon@6.1.5/pkg/sinon.js"; /* globals sinon */
4+
5+
import * as EnvironmentalOptions from "../EnvironmentalOptions.js";
6+
7+
describe("options module: AutomaticSettings.EnvironmentalOptions", function () {
8+
describe("isMobile()", function () {
9+
it("returns true as browser is a mobile browser", async function () {
10+
const result = await EnvironmentalOptions.isMobile();
11+
12+
chai.assert.isTrue(result);
13+
});
14+
});
15+
16+
describe("isMozilla()", function () {
17+
it("returns true as browser is a Mozilla browser", async function () {
18+
const result = await EnvironmentalOptions.isMozilla();
19+
20+
chai.assert.isTrue(result);
21+
});
22+
});
23+
24+
describe("isFirefox()", function () {
25+
it("returns true as browser is a Mozilla Firefox", async function () {
26+
const result = await EnvironmentalOptions.isFirefox();
27+
28+
chai.assert.isTrue(result);
29+
});
30+
});
31+
});

tests/run.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import "https://unpkg.com/mocha@5.2.0/mocha.js"; /* globals mocha */
22

33
/* tests */
44
import "./automaticSettings.test.js";
5+
import "./environmentalOptions.test.js";
56

67
mocha.checkLeaks();
78
mocha.run();

0 commit comments

Comments
 (0)