MCPcopy
hub / github.com/Koenkk/zigbee2mqtt / writeAndCheck

Function writeAndCheck

test/settings.test.ts:149–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147 write(devicesFile, contentDevices);
148
149 const writeAndCheck = (): void => {
150 expect(settings.write()); // trigger writing of ENVs
151 expect(settings.validate()).toStrictEqual([]);
152 expect(settings.get()).toStrictEqual(expected);
153
154 settings.set(["advanced", "channel"], 25);
155 expect(settings.get().advanced.channel).toStrictEqual(15);
156 expect(read(configurationFile)).toMatchObject({advanced: {channel: 15}});
157
158 expect(read(secretFile)).toMatchObject({password: "the-password"});
159 expect(read(configurationFile)).toHaveProperty("mqtt.password", "!secret.yaml password");
160 };
161
162 // Write trice to ensure there are no side effects.
163 writeAndCheck();

Callers 1

settings.test.tsFile · 0.85

Calls 3

getMethod · 0.80
setMethod · 0.80
readFunction · 0.70

Tested by

no test coverage detected