Skip to content

Commit a8ee796

Browse files
committed
Update chip-test instructions
1 parent 21790ba commit a8ee796

4 files changed

Lines changed: 36 additions & 103 deletions

File tree

.claude/rules/chip-tests/chip-tests.instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ paths:
66
- 'chipTests.log'
77
- 'chipTestsSummary.log'
88
- 'scripts/run-chip-tests.mjs'
9+
- 'scripts/run-matterbridge-chip-tests.mjs'
10+
- 'packages/core/src/chipTest.ts'
911
- '.github/workflows/chip-tests.yml'
1012
---
1113

.github/instructions/chip-tests/chip-tests.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: 'CHIP Conformance Test Harness v.1.0.0'
33
description: 'How the CHIP conformance test harness works for a Matterbridge plugin'
4-
applyTo: 'chipTests.json, chipTests.md, chipTests.log, chipTestsSummary.log, scripts/run-chip-tests.mjs, .github/workflows/chip-tests.yml'
4+
applyTo: 'chipTests.json, chipTests.md, chipTests.log, chipTestsSummary.log, scripts/run-chip-tests.mjs, scripts/run-matterbridge-chip-tests.mjs, packages/core/src/chipTest.ts, .github/workflows/chip-tests.yml'
55
---
66

77
# CHIP Conformance Test Harness

.github/prompts/jest-to-vitest.prompt.md

Lines changed: 0 additions & 96 deletions
This file was deleted.

packages/core/vitest/behaviors/matterbridgeServer.test.ts

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,11 +1416,34 @@ describe('Server clusters and behaviors', () => {
14161416
};
14171417
const callReactor = (state: Record<string, unknown>, newPresets: Thermostat.Preset[], oldPresets: Thermostat.Preset[]) => {
14181418
const server = { state, endpoint } as unknown as MatterbridgeThermostatServer;
1419-
(MatterbridgeThermostatServer.prototype as unknown as { removeThermostatSuggestionsForRemovedPresets: (n: Thermostat.Preset[], o: Thermostat.Preset[]) => void }).removeThermostatSuggestionsForRemovedPresets.call(server, newPresets, oldPresets);
1419+
(
1420+
MatterbridgeThermostatServer.prototype as unknown as { removeThermostatSuggestionsForRemovedPresets: (n: Thermostat.Preset[], o: Thermostat.Preset[]) => void }
1421+
).removeThermostatSuggestionsForRemovedPresets.call(server, newPresets, oldPresets);
1422+
};
1423+
const pendingPreset: Thermostat.Preset = {
1424+
presetHandle: null,
1425+
presetScenario: Thermostat.PresetScenario.Sleep,
1426+
name: 'Pending',
1427+
coolingSetpoint: 2600,
1428+
heatingSetpoint: 2000,
1429+
builtIn: null,
1430+
};
1431+
const preset2: Thermostat.Preset = {
1432+
presetHandle: Uint8Array.from([2]),
1433+
presetScenario: Thermostat.PresetScenario.Wake,
1434+
name: 'Preset2',
1435+
coolingSetpoint: 2600,
1436+
heatingSetpoint: 2000,
1437+
builtIn: null,
1438+
};
1439+
const preset3: Thermostat.Preset = {
1440+
presetHandle: Uint8Array.from([3]),
1441+
presetScenario: Thermostat.PresetScenario.Vacation,
1442+
name: 'Preset3',
1443+
coolingSetpoint: 2600,
1444+
heatingSetpoint: 2000,
1445+
builtIn: null,
14201446
};
1421-
const pendingPreset: Thermostat.Preset = { presetHandle: null, presetScenario: Thermostat.PresetScenario.Sleep, name: 'Pending', coolingSetpoint: 2600, heatingSetpoint: 2000, builtIn: null };
1422-
const preset2: Thermostat.Preset = { presetHandle: Uint8Array.from([2]), presetScenario: Thermostat.PresetScenario.Wake, name: 'Preset2', coolingSetpoint: 2600, heatingSetpoint: 2000, builtIn: null };
1423-
const preset3: Thermostat.Preset = { presetHandle: Uint8Array.from([3]), presetScenario: Thermostat.PresetScenario.Vacation, name: 'Preset3', coolingSetpoint: 2600, heatingSetpoint: 2000, builtIn: null };
14241447
const suggestionForPreset2: Thermostat.ThermostatSuggestion = { uniqueId: 10, presetHandle: Uint8Array.from([2]), effectiveTime: 1700000000, expirationTime: 1700003600 };
14251448
const suggestionForPreset3: Thermostat.ThermostatSuggestion = { uniqueId: 11, presetHandle: Uint8Array.from([3]), effectiveTime: 1700000000, expirationTime: 1700003600 };
14261449

@@ -1442,7 +1465,11 @@ describe('Server clusters and behaviors', () => {
14421465

14431466
// Line 106 false branch: the removed Preset is referenced by a ThermostatSuggestions entry (pruned) but not by
14441467
// CurrentThermostatSuggestion, which is left untouched.
1445-
const state3 = { thermostatSuggestions: [suggestionForPreset2, suggestionForPreset3], currentThermostatSuggestion: suggestionForPreset2, thermostatSuggestionNotFollowingReason: { ongoingHold: true } };
1468+
const state3 = {
1469+
thermostatSuggestions: [suggestionForPreset2, suggestionForPreset3],
1470+
currentThermostatSuggestion: suggestionForPreset2,
1471+
thermostatSuggestionNotFollowingReason: { ongoingHold: true },
1472+
};
14461473
callReactor(state3, [pendingPreset, preset2], [pendingPreset, preset2, preset3]);
14471474
expect(state3.thermostatSuggestions).toEqual([suggestionForPreset2]);
14481475
expect(state3.currentThermostatSuggestion).toBe(suggestionForPreset2);
@@ -1521,7 +1548,7 @@ describe('Server clusters and behaviors', () => {
15211548
// when ExpressedState is not Normal (here forced via testInProgress, since the plugin command handler still
15221549
// runs first regardless).
15231550
await smoke.setAttribute(SmokeCoAlarm.id, 'testInProgress', true);
1524-
await expect(smoke.invokeBehaviorCommand(SmokeCoAlarm, 'selfTestRequest', {})).rejects.toMatchObject({ code: Status.Busy });
1551+
await expect(smoke.invokeBehaviorCommand(SmokeCoAlarm, 'selfTestRequest')).rejects.toMatchObject({ code: Status.Busy });
15251552
await smoke.setAttribute(SmokeCoAlarm.id, 'testInProgress', false);
15261553

15271554
// Reduce the self-test duration so the timer-driven completion (#completeSelfTest) fires promptly and does not

0 commit comments

Comments
 (0)