Some checks failed
CI / test-backend (push) Successful in 32s
CI / lint (push) Failing after 2m12s
CI / build-frontend (pull_request) Successful in 1m38s
Build and Publish Docker Image / build (pull_request) Has been skipped
CI / test-backend (pull_request) Successful in 24s
OSV-Scanner PR Scan / scan-pr (pull_request) Successful in 53s
CI / test-lang (pull_request) Successful in 1m15s
CI / lint (pull_request) Failing after 5m8s
CI / build-frontend (push) Successful in 9m46s
CI / test-lang (push) Successful in 9m48s
Tests / test (push) Successful in 13m32s
Tests / test (pull_request) Successful in 11m23s
Build Test / Build and Test (push) Successful in 15m56s
Build and Publish Docker Image / build-dev (pull_request) Successful in 13m42s
Build Test / Build and Test (pull_request) Successful in 16m9s
- Introduced new test files for telemetry functionality, including integration, fuzzing, and extended tests to ensure robustness and performance. - Added tests for parsing LXMF display names and telemetry data, addressing potential bugs and ensuring correct handling of various input formats. - Implemented performance tests for the InterfacesPage component, validating rendering efficiency with a large number of discovered interfaces. - Enhanced existing tests for markdown rendering and link utilities to cover additional edge cases and improve stability.
48 lines
2.1 KiB
JavaScript
48 lines
2.1 KiB
JavaScript
import { describe, it, expect } from "vitest";
|
|
import LinkUtils from "@/js/LinkUtils";
|
|
|
|
describe("LinkUtils.js", () => {
|
|
describe("renderNomadNetLinks", () => {
|
|
it("detects nomadnet:// links with hash and path", () => {
|
|
const text = "nomadnet://1dfeb0d794963579bd21ac8f153c77a4:/page/index.mu";
|
|
const result = LinkUtils.renderNomadNetLinks(text);
|
|
expect(result).toContain('data-nomadnet-url="1dfeb0d794963579bd21ac8f153c77a4:/page/index.mu"');
|
|
});
|
|
|
|
it("detects bare hash and path links", () => {
|
|
const text = "1dfeb0d794963579bd21ac8f153c77a4:/page/index.mu";
|
|
const result = LinkUtils.renderNomadNetLinks(text);
|
|
expect(result).toContain('data-nomadnet-url="1dfeb0d794963579bd21ac8f153c77a4:/page/index.mu"');
|
|
});
|
|
|
|
it("detects nomadnet:// links with just hash", () => {
|
|
const text = "nomadnet://1dfeb0d794963579bd21ac8f153c77a4";
|
|
const result = LinkUtils.renderNomadNetLinks(text);
|
|
expect(result).toContain('data-nomadnet-url="1dfeb0d794963579bd21ac8f153c77a4:/page/index.mu"');
|
|
});
|
|
});
|
|
|
|
describe("renderStandardLinks", () => {
|
|
it("detects http links", () => {
|
|
const text = "visit http://example.com";
|
|
const result = LinkUtils.renderStandardLinks(text);
|
|
expect(result).toContain('<a href="http://example.com"');
|
|
});
|
|
|
|
it("detects https links", () => {
|
|
const text = "visit https://example.com/path?query=1";
|
|
const result = LinkUtils.renderStandardLinks(text);
|
|
expect(result).toContain('<a href="https://example.com/path?query=1"');
|
|
});
|
|
});
|
|
|
|
describe("renderAllLinks", () => {
|
|
it("detects both types of links", () => {
|
|
const text = "Check https://google.com and nomadnet://1dfeb0d794963579bd21ac8f153c77a4";
|
|
const result = LinkUtils.renderAllLinks(text);
|
|
expect(result).toContain('href="https://google.com"');
|
|
expect(result).toContain('data-nomadnet-url="1dfeb0d794963579bd21ac8f153c77a4:/page/index.mu"');
|
|
});
|
|
});
|
|
});
|