node-red-contrib-homebridge-automation 0.3.0-beta.7 → 0.3.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homebridge-automation",
3
- "version": "0.3.0-beta.7",
3
+ "version": "0.3.0-beta.9",
4
4
  "description": "NodeRED Automation for HomeBridge",
5
5
  "main": "src/HAP-NodeRed.js",
6
6
  "scripts": {
@@ -2,6 +2,7 @@ const { HapClient } = require('@homebridge/hap-client');
2
2
  const debug = require('debug')('hapNodeRed:hbConfigNode');
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const process = require('process');
5
6
 
6
7
  class HBConfigNode {
7
8
  constructor(config, RED) {
@@ -56,7 +57,7 @@ class HBConfigNode {
56
57
  const updatedDevices = await this.hapClient.getAllServices();
57
58
  if (this.debugLogging && updatedDevices && updatedDevices.length && process.uptime() < 300) {
58
59
  try {
59
- const storagePath = path.join(process.cwd(), '/homebridge-automation-endpoints.json');
60
+ const storagePath = path.join(process.cwd(), 'homebridge-automation-endpoints.json');
60
61
  this.warn(`Writing Homebridge endpoints to ${storagePath}`);
61
62
  fs.writeFileSync(storagePath, JSON.stringify(updatedDevices, null, 2));
62
63
  } catch (e) {
@@ -1,8 +1,8 @@
1
-
2
- const { HapClient } = require('@homebridge/hap-client');
1
+ // File: src/hbConfigNode.test.js
3
2
  const HBConfigNode = require('./hbConfigNode'); // Update the path as necessary
4
3
  const fs = require('fs');
5
4
  const path = require('path');
5
+ const process = require('process');
6
6
 
7
7
  jest.mock('@homebridge/hap-client', () => {
8
8
  return {
@@ -20,7 +20,6 @@ describe('Issue 142', () => {
20
20
  let mockConfig;
21
21
  let RED;
22
22
  let node;
23
- let mockHapClient;
24
23
 
25
24
  beforeEach(() => {
26
25
  mockConfig = {
@@ -57,7 +56,6 @@ describe('HBConfigNode', () => {
57
56
  let mockConfig;
58
57
  let RED;
59
58
  let node;
60
- let mockHapClient;
61
59
 
62
60
  beforeEach(() => {
63
61
  mockConfig = {
@@ -94,7 +92,6 @@ describe('from files', () => {
94
92
  let mockConfig;
95
93
  let RED;
96
94
  let node;
97
- let mockHapClient;
98
95
 
99
96
  beforeEach(() => {
100
97
  mockConfig = {