Browse Source

Adds tests. Bout time

craigsdennis 9 years ago
parent
commit
9d4c7ff6f1
2 changed files with 19 additions and 2 deletions
  1. 5 2
      package.json
  2. 14 0
      test/rom_comm_test.js

+ 5 - 2
package.json

@@ -4,7 +4,8 @@
   "description": "A GUI tool for flashing the Espruino JavaScript runtime on Adafruit Huzzah (ESP8366 based) boards",
   "main": "index.js",
   "scripts": {
-    "start": "electron index.js"
+    "start": "electron index.js",
+    "test": "mocha"
   },
   "repository": {
     "type": "git",
@@ -32,6 +33,8 @@
     "unzip": "^0.1.11"
   },
   "devDependencies": {
-    "electron-prebuilt": "^0.36.9"
+    "chai": "^3.5.0",
+    "electron-prebuilt": "^0.36.9",
+    "mocha": "^2.4.5"
   }
 }

+ 14 - 0
test/rom_comm_test.js

@@ -0,0 +1,14 @@
+'use strict';
+
+const expect = require('chai').expect;
+const RomComm = require('../back-end/rom_comm');
+
+describe('ESP8266', () => {
+    const boards = require('../back-end/boards');
+    it('defaults to the Esp12', () => {
+        var esp = new RomComm({
+            portName: 'TEST'
+        });
+        expect(esp.board).to.be.an.instanceof(boards.Esp12);
+    });
+});