Skip to content

Commit 3d003b3

Browse files
fix luacheck and test issues
1 parent 5e0a04e commit 3d003b3

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

drivers/SmartThings/matter-switch/src/test/test_aqara_climate_sensor_w100.lua

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
-- Copyright © 2024 SmartThings, Inc.
22
-- Licensed under the Apache License, Version 2.0
33

4-
local test = require "integration_test"
5-
local t_utils = require "integration_test.utils"
64
local capabilities = require "st.capabilities"
7-
local utils = require "st.utils"
8-
local dkjson = require "dkjson"
9-
local uint32 = require "st.matter.data_types.Uint32"
105
local clusters = require "st.matter.generated.zap_clusters"
11-
local button_attr = capabilities.button.button
6+
local t_utils = require "integration_test.utils"
7+
local test = require "integration_test"
8+
local uint32 = require "st.matter.data_types.Uint32"
129

1310
-- Mock a 3-button device with temperature and humidity sensor
1411
local aqara_mock_device = test.mock_device.build_test_matter_device({
@@ -100,13 +97,13 @@ local aqara_mock_device = test.mock_device.build_test_matter_device({
10097

10198
local function configure_buttons()
10299
test.socket.matter:__expect_send({aqara_mock_device.id, clusters.Switch.attributes.MultiPressMax:read(aqara_mock_device, 3)})
103-
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button1", button_attr.pushed({state_change = false})))
100+
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button1", capabilities.button.button.pushed({state_change = false})))
104101

105102
test.socket.matter:__expect_send({aqara_mock_device.id, clusters.Switch.attributes.MultiPressMax:read(aqara_mock_device, 4)})
106-
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button2", button_attr.pushed({state_change = false})))
103+
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button2", capabilities.button.button.pushed({state_change = false})))
107104

108105
test.socket.matter:__expect_send({aqara_mock_device.id, clusters.Switch.attributes.MultiPressMax:read(aqara_mock_device, 5)})
109-
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button3", button_attr.pushed({state_change = false})))
106+
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button3", capabilities.button.button.pushed({state_change = false})))
110107
end
111108

112109
local function test_init()
@@ -309,7 +306,7 @@ test.register_coroutine_test(
309306
clusters.Switch.events.MultiPressComplete:build_test_event_report(aqara_mock_device, 4, {new_position = 0, total_number_of_presses_counted = 2, previous_position = 1})
310307
}
311308
)
312-
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button2", button_attr.double({state_change = true})))
309+
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button2", capabilities.button.button.double({state_change = true})))
313310
end
314311
)
315312

@@ -329,7 +326,7 @@ test.register_coroutine_test(
329326
clusters.Switch.events.LongPress:build_test_event_report(aqara_mock_device, 3, {new_position = 1})
330327
}
331328
)
332-
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button1", button_attr.held({state_change = true})))
329+
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button1", capabilities.button.button.held({state_change = true})))
333330
test.socket.matter:__queue_receive(
334331
{
335332
aqara_mock_device.id,
@@ -355,7 +352,7 @@ test.register_coroutine_test(
355352
clusters.Switch.events.LongPress:build_test_event_report(aqara_mock_device, 5, {new_position = 1})
356353
}
357354
)
358-
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button3", button_attr.held({state_change = true})))
355+
test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button3", capabilities.button.button.held({state_change = true})))
359356
test.socket.matter:__queue_receive(
360357
{
361358
aqara_mock_device.id,
@@ -376,7 +373,7 @@ test.register_coroutine_test(
376373
}
377374
)
378375
test.socket.capability:__expect_send(
379-
aqara_mock_device:generate_test_message("button1", button_attr.double({state_change = true}))
376+
aqara_mock_device:generate_test_message("button1", capabilities.button.button.double({state_change = true}))
380377
)
381378
end
382379
)

drivers/SmartThings/matter-switch/src/test/test_matter_button.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ test.set_test_init_function(test_init)
9090
test.register_coroutine_test(
9191
"Simulate the profile change update taking affect and the device info changing",
9292
function()
93+
test.socket.matter:__set_channel_ordering("relaxed")
9394
update_profile()
95+
test.wait_for_events()
9496
local device_info_copy = utils.deep_copy(mock_device.raw_st_data)
9597
device_info_copy.profile.id = "buttons-battery"
9698
local device_info_json = dkjson.encode(device_info_copy)

drivers/SmartThings/matter-switch/src/test/test_matter_multi_button.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ test.set_test_init_function(test_init)
159159
test.register_coroutine_test(
160160
"Simulate the profile change update taking affect and the device info changing",
161161
function()
162+
test.socket.matter:__set_channel_ordering("relaxed")
162163
update_profile()
164+
test.wait_for_events()
163165
local device_info_copy = utils.deep_copy(mock_device.raw_st_data)
164166
device_info_copy.profile.id = "5-buttons-battery"
165167
local device_info_json = dkjson.encode(device_info_copy)

0 commit comments

Comments
 (0)