homebridge-alexa 0.9.3-beta.0 → 0.9.3-beta.2

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.
@@ -1,4 +1,5 @@
1
1
  name: "Build, Publish and Release"
2
+
2
3
 
3
4
  #
4
5
  # Automatically publish beta releases on pushes, require a manual workflow action for production releases
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-alexa",
3
- "version": "0.9.3-beta.0",
3
+ "version": "0.9.3-beta.2",
4
4
  "description": "Control your Homebridge devices with Amazon Alexa.",
5
5
  "main": "src/plugin.js",
6
6
  "scripts": {
@@ -190,7 +190,7 @@ function alexaResponse(message, hbResponse, err, value) {
190
190
  "properties": [{
191
191
  "namespace": "Alexa.RangeController",
192
192
  "instance": message.directive.header.instance,
193
- "name": message.directive.header.name,
193
+ "name": "rangeValue",
194
194
  "value": value,
195
195
  "timeOfSample": now.toISOString(),
196
196
  "uncertaintyInMilliseconds": 500
@@ -1,7 +1,7 @@
1
- const { alexaResponse, alexaStateResponse, eventMessage } = require('/Users/sgracey/Code/homebridge-alexa/src/lib/alexaMessages');
2
- const messages = require('/Users/sgracey/Code/homebridge-alexa/src/lib/parse/messages');
1
+ const { alexaResponse, alexaStateResponse, eventMessage } = require('./alexaMessages');
2
+ const messages = require('./parse/messages');
3
3
 
4
- jest.mock('/Users/sgracey/Code/homebridge-alexa/src/lib/parse/messages');
4
+ jest.mock('./parse/messages');
5
5
 
6
6
  describe('alexaMessages', () => {
7
7
  describe('alexaResponse', () => {
@@ -81,6 +81,50 @@ describe('alexaMessages', () => {
81
81
  expect(response.context.properties[0].value).toBe('ON');
82
82
  });
83
83
 
84
+ test('should return correct response for Alexa.RangeController SetRangeValue', () => {
85
+ const message = {
86
+ directive: {
87
+ header: {
88
+ messageId: '123',
89
+ namespace: 'Alexa.RangeController',
90
+ name: 'SetRangeValue',
91
+ instance: 'Blind.Lift'
92
+ },
93
+ endpoint: {
94
+ endpointId: 'endpoint-001'
95
+ }
96
+ }
97
+ };
98
+ const rangeValue = 50;
99
+ const response = alexaResponse(message, { characteristics: [{ status: 0 }] }, null, rangeValue);
100
+ expect(response.context.properties[0].namespace).toBe('Alexa.RangeController');
101
+ expect(response.context.properties[0].instance).toBe('Blind.Lift');
102
+ expect(response.context.properties[0].name).toBe('rangeValue');
103
+ expect(response.context.properties[0].value).toBe(50);
104
+ });
105
+
106
+ test('should return correct response for Alexa.RangeController AdjustRangeValue', () => {
107
+ const message = {
108
+ directive: {
109
+ header: {
110
+ messageId: '123',
111
+ namespace: 'Alexa.RangeController',
112
+ name: 'AdjustRangeValue',
113
+ instance: 'Blind.Lift'
114
+ },
115
+ endpoint: {
116
+ endpointId: 'endpoint-001'
117
+ }
118
+ }
119
+ };
120
+ const rangeValue = 75;
121
+ const response = alexaResponse(message, { characteristics: [{ status: 0 }] }, null, rangeValue);
122
+ expect(response.context.properties[0].namespace).toBe('Alexa.RangeController');
123
+ expect(response.context.properties[0].instance).toBe('Blind.Lift');
124
+ expect(response.context.properties[0].name).toBe('rangeValue');
125
+ expect(response.context.properties[0].value).toBe(75);
126
+ });
127
+
84
128
  // Add more test cases for other namespaces and scenarios
85
129
  });
86
130
 
@@ -1,4 +1,4 @@
1
- const { stateToProperties } = require('/Users/sgracey/Code/homebridge-alexa/src/lib/parse/messages');
1
+ const { stateToProperties } = require('./messages');
2
2
 
3
3
  describe('stateToProperties', () => {
4
4
  const now = new Date();