refactor(tests): clean up test code by removing unnecessary line breaks and improving formatting for better readability

This commit is contained in:
Ivan committed 2026-04-19 11:35:43 -05:00
1 parent 594b84fe33
commit 0b9245830b
5 files changed
+14 -25

No files matched your search

+4 -7
View File
@@ -47,14 +47,11 @@ describe("Diagnostics.diagnose", () => {
});
it("flags not_provisioned when rom.parse returns falsy", async () => {
const result = await diagnose(
fakeRnode({ getRomAsObject: async () => ({ eeprom: [], parse: () => null }) }),
{ timeoutMs: 1000 }
);
const result = await diagnose(fakeRnode({ getRomAsObject: async () => ({ eeprom: [], parse: () => null }) }), {
timeoutMs: 1000,
});
expect(result.issues).toContain(ISSUE_NOT_PROVISIONED);
expect(result.suggestionKeys).toContain(
"tools.rnode_flasher.diagnostics.suggestions.not_provisioned"
);
expect(result.suggestionKeys).toContain("tools.rnode_flasher.diagnostics.suggestions.not_provisioned");
});
it("flags firmware_hash_missing when target hash is all zero or missing", async () => {
+4 -11
View File
@@ -12,9 +12,7 @@ describe("RNodeFlasherPage.vue", () => {
json: () =>
Promise.resolve({
tag_name: "v1.0",
assets: [
{ name: "firmware.zip", browser_download_url: "http://example.com/firmware.zip" },
],
assets: [{ name: "firmware.zip", browser_download_url: "http://example.com/firmware.zip" }],
}),
});
}
@@ -56,9 +54,7 @@ describe("RNodeFlasherPage.vue", () => {
const wrapper = mountRNodeFlasherPage();
expect(wrapper.vm.showAdvanced).toBe(false);
const advancedButton = wrapper
.findAll("button")
.find((b) => b.text().includes("tools.rnode_flasher.advanced"));
const advancedButton = wrapper.findAll("button").find((b) => b.text().includes("tools.rnode_flasher.advanced"));
await advancedButton.trigger("click");
expect(wrapper.vm.showAdvanced).toBe(true);
@@ -68,8 +64,7 @@ describe("RNodeFlasherPage.vue", () => {
it("switches connection method", async () => {
const wrapper = mountRNodeFlasherPage();
const wifiButton = wrapper
.findAll('[data-testid="rnode-transport-wifi"]')[0];
const wifiButton = wrapper.findAll('[data-testid="rnode-transport-wifi"]')[0];
await wifiButton.trigger("click");
expect(wrapper.vm.connectionMethod).toBe("wifi");
@@ -97,8 +92,6 @@ describe("RNodeFlasherPage.vue", () => {
wrapper.vm.selectedProduct = { firmware_filename: "rnode_firmware_heltec32v3.zip" };
wrapper.vm.latestRelease = null;
const url = wrapper.vm._resolveRecommendedAssetUrl();
expect(url).toMatch(
/\/Reticulum\/RNode_Firmware\/releases\/latest\/download\/rnode_firmware_heltec32v3\.zip$/
);
expect(url).toMatch(/\/Reticulum\/RNode_Firmware\/releases\/latest\/download\/rnode_firmware_heltec32v3\.zip$/);
});
});
+5 -3
View File
@@ -19,9 +19,11 @@ describe("SerialTransport.request", () => {
const env = {
navigator: {
serial: {
requestPort: vi.fn().mockRejectedValue(
Object.assign(new Error("No port selected by the user."), { name: "NotFoundError" })
),
requestPort: vi
.fn()
.mockRejectedValue(
Object.assign(new Error("No port selected by the user."), { name: "NotFoundError" })
),
},
},
};
+1 -3
View File
@@ -58,9 +58,7 @@ describe("StickerView.vue", () => {
it("TGS renders placeholder without fetching sticker URL", async () => {
const baseFetch = globalThis.fetch;
const fetchSpy = vi.spyOn(globalThis, "fetch").mockImplementation((input, init) =>
baseFetch(input, init)
);
const fetchSpy = vi.spyOn(globalThis, "fetch").mockImplementation((input, init) => baseFetch(input, init));
const w = mount(StickerView, {
props: {
@@ -88,5 +88,4 @@ describe("fuzzing: TGS decode", () => {
}
expect(true).toBe(true);
});
});