mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-10-23 09:12:29 +00:00
refactor(tests): clean up test code by removing unnecessary line breaks and improving formatting for better readability
This commit is contained in:
5 files changed
+14
-25
No files matched your search
@@ -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 () => {
|
||||
|
||||
@@ -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$/);
|
||||
});
|
||||
});
|
||||
@@ -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" })
|
||||
),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user