diff --git a/docs/led_index.js.html b/docs/led_index.js.html
index c36f8ff..acef21b 100644
--- a/docs/led_index.js.html
+++ b/docs/led_index.js.html
@@ -118,7 +118,6 @@
led/index.js
isRunning: false,
value: 0,
direction: 1,
- mode: null,
interval: null
};
@@ -170,11 +169,6 @@ led/index.js
return this.#state.value;
}
},
- mode: {
- get: function() {
- return this.#state.mode;
- }
- },
isOn: {
get: function() {
return !!this.#state.value;
diff --git a/docs/module-j5e_led-LED.html b/docs/module-j5e_led-LED.html
index 2e018dc..7bc523a 100644
--- a/docs/module-j5e_led-LED.html
+++ b/docs/module-j5e_led-LED.html
@@ -199,7 +199,7 @@ Parameters
@@ -254,7 +254,7 @@ on
@@ -311,7 +311,7 @@ off
@@ -368,7 +368,7 @@ toggle
@@ -450,7 +450,7 @@ Parameters
@@ -525,7 +525,7 @@ Parameters
@@ -600,7 +600,7 @@ Parameters
@@ -697,7 +697,7 @@ Parameters
@@ -786,7 +786,7 @@ Parameters
@@ -876,7 +876,7 @@ Parameters
@@ -965,7 +965,7 @@ Parameters
@@ -1047,7 +1047,7 @@ Parameters
@@ -1108,7 +1108,7 @@ stop
diff --git a/lib/led/index.js b/lib/led/index.js
index ba825b0..b2d99b2 100644
--- a/lib/led/index.js
+++ b/lib/led/index.js
@@ -22,7 +22,6 @@ class LED {
isRunning: false,
value: 0,
direction: 1,
- mode: null,
interval: null
};
@@ -74,11 +73,6 @@ class LED {
return this.#state.value;
}
},
- mode: {
- get: function() {
- return this.#state.mode;
- }
- },
isOn: {
get: function() {
return !!this.#state.value;
diff --git a/package.json b/package.json
index cc3b8b4..2f7e64c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "j5e",
- "version": "0.4.6",
+ "version": "0.4.7",
"description": "j5e is a device framework built for ECMA TC-53's IO pattern",
"main": "index.js",
"exports": {
diff --git a/test/led.js b/test/led.js
index 5624c5c..b1df434 100644
--- a/test/led.js
+++ b/test/led.js
@@ -23,13 +23,74 @@ describe("LED - Digital", function() {
});
describe("Properties", function() {
- // describe('someProperty', function() {
- // it('should do a thing base on the property value', async function() {
- // ...
- // });
- // [ all other tests related to someProperty ]
- // });
- // [ All other properties, each with it's own describe ]
+
+ describe("value", function() {
+
+ it("should return the current value", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: Digital
+ });
+
+ led.on(1);
+ assert.equal(led.value, 1);
+
+ });
+ });
+
+ describe("isOn", function() {
+
+ it("should return true if the LED is on", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: Digital
+ });
+
+ led.on();
+ assert.equal(led.isOn, true);
+
+ led.off();
+ assert.equal(led.isOn, false);
+
+ });
+ });
+
+ describe("isRunning", function() {
+
+ it("should return true if the LED is blinking", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: Digital
+ });
+
+ assert.equal(led.isRunning, false);
+
+ led.blink();
+ assert.equal(led.isRunning, true);
+
+ led.stop();
+ assert.equal(led.isRunning, false);
+
+ });
+
+ it("should return true if the LED is pulsing", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: Digital
+ });
+
+ assert.equal(led.isRunning, false);
+
+ led.pulse();
+ assert.equal(led.isRunning, true);
+
+ led.stop();
+ assert.equal(led.isRunning, false);
+
+ });
+
+ });
+
});
describe("Methods", function() {
@@ -166,6 +227,82 @@ describe("LED - PWM", function() {
assert.equal(led.HIGH, 1023);
});
+
+ });
+
+ describe("Properties", function() {
+
+ describe("value", function() {
+
+ it("should return the current value", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: PWM
+ });
+
+ led.on();
+ assert.equal(led.value, 1023);
+
+ led.brightness(512);
+ assert.equal(led.value, 512);
+
+
+ });
+ });
+
+ describe("isOn", function() {
+
+ it("should return true if the LED is on", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: Digital
+ });
+
+ led.on();
+ assert.equal(led.isOn, true);
+
+ led.off();
+ assert.equal(led.isOn, false);
+
+ });
+ });
+
+ describe("isRunning", function() {
+
+ it("should return true if the LED is blinking", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: Digital
+ });
+
+ assert.equal(led.isRunning, false);
+
+ led.blink();
+ assert.equal(led.isRunning, true);
+
+ led.stop();
+ assert.equal(led.isRunning, false);
+
+ });
+
+ it("should return true if the LED is pulsing", async function() {
+ const led = await new LED({
+ pin: 12,
+ io: Digital
+ });
+
+ assert.equal(led.isRunning, false);
+
+ led.pulse();
+ assert.equal(led.isRunning, true);
+
+ led.stop();
+ assert.equal(led.isRunning, false);
+
+ });
+
+ });
+
});
describe("Methods", function() {