+
= T | undefined | null;
const registryStore = useRegistryStore();
diff --git a/src/components/address/AddressHeader.vue b/src/components/address/AddressHeader.vue
index 3b8a452..a156dc1 100644
--- a/src/components/address/AddressHeader.vue
+++ b/src/components/address/AddressHeader.vue
@@ -68,7 +68,7 @@ onBeforeUnmount(() => {
const qrAddress = computed(() =>
normalizeDisplayAddress(props.address, {
removePrefix: false,
- }),
+ }) || "",
);
const displayAddress = computed(() => normalizeDisplayAddress(props.address));
const addressType = computed(() => getAddressType(qrAddress.value));
diff --git a/src/components/address/AddressTransaction.vue b/src/components/address/AddressTransaction.vue
index 01c3c90..c0e28c2 100644
--- a/src/components/address/AddressTransaction.vue
+++ b/src/components/address/AddressTransaction.vue
@@ -25,29 +25,24 @@
diff --git a/src/components/Transaction/TransactionList.vue b/src/components/Transaction/TransactionList.vue
index 90a16c2..4b3335a 100644
--- a/src/components/Transaction/TransactionList.vue
+++ b/src/components/Transaction/TransactionList.vue
@@ -106,7 +106,7 @@ export type Transactions = Array<{
diff --git a/src/components/token/Address.vue b/src/components/token/Address.vue
index 303bcef..2a003e8 100644
--- a/src/components/token/Address.vue
+++ b/src/components/token/Address.vue
@@ -66,6 +66,7 @@ const addressList = computed(() => {
([lockingBytecode, amount]) => {
const address = formatLockingBytecodeAddress(
lockingBytecode.substring(2),
+ { tokenCategory: `\\x${props.category}` },
);
if (typeof address !== "string") {
return [];
diff --git a/src/components/token/Child.vue b/src/components/token/Child.vue
index 8c0eb39..de2555c 100644
--- a/src/components/token/Child.vue
+++ b/src/components/token/Child.vue
@@ -81,6 +81,7 @@ const childNfts = computed(() => {
const commitment = output.nonfungible_token_commitment?.substring(2) || "";
const address = formatLockingBytecodeAddress(
output.locking_bytecode.substring(2),
+ { tokenCategory: `\\x${props.category}` },
);
return {
@@ -112,6 +113,7 @@ const outputs = computed(() => {
// Convert locking bytecode to cash address
const address = formatLockingBytecodeAddress(
output.locking_bytecode.substring(2),
+ { tokenCategory: `\\x${props.category}` },
);
// Get nonfungible token commitment
const commitment = output.nonfungible_token_commitment?.substring(2);
diff --git a/src/hooks/addressDisplay.ts b/src/hooks/addressDisplay.ts
index 7c979cc..d66f86d 100644
--- a/src/hooks/addressDisplay.ts
+++ b/src/hooks/addressDisplay.ts
@@ -1,62 +1,107 @@
+import {
+ Base58AddressFormatVersion,
+ base58AddressToLockingBytecode,
+ cashAddressToLockingBytecode,
+ lockingBytecodeToCashAddress,
+} from "@bitauth/libauth";
+import { type InferOutput, picklist, safeParse } from "valibot";
import { useStorage } from "~/hooks/storage";
import {
addPrefixToAddress,
- addressToLockingBytecodeHex,
+ getAddressType,
removeAddressPrefix,
} from "~/module/bitcoin";
-import { useStateStore } from "~/store";
+import { useStateStore } from "~/store/state";
+import type { Utxo } from "~/types";
+
+const addressDisplayModeSchema = picklist(["auto", "token", "regular"]);
+export type AddressDisplayMode = InferOutput;
-export type AddressDisplayMode = "token" | "regular";
+export function useAddressDisplayPreference() {
+ const mode = useStorage("addressDisplayMode", "auto");
+ // Older versions also stored raw strings. useStorage reads both forms;
+ // validate here before a persisted value can control address encoding.
+ const saved = safeParse(addressDisplayModeSchema, mode.value);
+ mode.value = saved.success ? saved.output : "auto";
+ return mode;
+}
-export const addressDisplayMode = useStorage(
- "addressDisplayMode",
- "token",
-);
+export const addressDisplayMode = useAddressDisplayPreference();
type AddressFormatOptions = {
removePrefix?: boolean;
+ tokenCategory?: Utxo["token_category"];
};
-const withDefaultOptions = (opts?: AddressFormatOptions) => ({
- removePrefix: opts?.removePrefix ?? true,
-});
-
-export const formatLockingBytecodeAddress = (
+export function formatLockingBytecodeAddress(
lockingBytecodeHex: string,
opts?: AddressFormatOptions,
-) => {
- const stateStore = useStateStore();
- const tokenSupport = addressDisplayMode.value === "token";
- const address = stateStore.lockingBytecodeHexToCashAddress(
+) {
+ const tokenSupport = {
+ auto: Boolean(opts?.tokenCategory),
+ token: true,
+ regular: false,
+ }[addressDisplayMode.value];
+ const address = useStateStore().lockingBytecodeHexToCashAddress(
lockingBytecodeHex,
tokenSupport,
);
- if (typeof address !== "string") return;
- const options = withDefaultOptions(opts);
- return options.removePrefix ? removeAddressPrefix(address) : address;
-};
+ if (!address) return;
+ return opts?.removePrefix === false ? address : removeAddressPrefix(address);
+}
-export const normalizeDisplayAddress = (
+// The input is a previous output (outpoint) for "from", or a new output for
+// "to". Never infer token presence from the FT amount or address history.
+export function formatUtxoAddress(
+ utxo: Pick,
+) {
+ const bytecode = utxo.locking_bytecode.startsWith("\\x")
+ ? utxo.locking_bytecode.substring(2)
+ : utxo.locking_bytecode;
+ const fullAddress = formatLockingBytecodeAddress(bytecode, {
+ removePrefix: false,
+ tokenCategory: utxo.token_category,
+ });
+ if (!fullAddress) return;
+ const address = removeAddressPrefix(fullAddress);
+ return {
+ fullAddress,
+ address,
+ addressType: getAddressType(fullAddress),
+ url: `/address/${address}`,
+ };
+}
+
+export function normalizeDisplayAddress(
address: string,
- opts?: AddressFormatOptions,
-) => {
- const options = withDefaultOptions(opts);
- const lockingBytecodeHex = addressToLockingBytecodeHex(address);
-
- if (lockingBytecodeHex) {
- const convertedAddress = formatLockingBytecodeAddress(
- lockingBytecodeHex,
- options,
- );
- if (typeof convertedAddress === "string") {
- return convertedAddress;
- }
- }
-
- if (options.removePrefix) {
- return removeAddressPrefix(address);
- }
-
- return addPrefixToAddress(address);
-};
+ opts?: Pick,
+) {
+ const legacy = base58AddressToLockingBytecode(address);
+ const decoded =
+ typeof legacy === "string"
+ ? cashAddressToLockingBytecode(addPrefixToAddress(address))
+ : {
+ bytecode: legacy.bytecode,
+ prefix:
+ legacy.version === Base58AddressFormatVersion.p2pkhTestnet ||
+ legacy.version === Base58AddressFormatVersion.p2sh20Testnet
+ ? ("bchtest" as const)
+ : ("bitcoincash" as const),
+ tokenSupport: false,
+ };
+ if (typeof decoded === "string") return address;
+
+ // An address page has no single UTXO. In auto mode preserve the incoming
+ // encoding (including its network) so following a link retains QR semantics.
+ const tokenSupport = {
+ auto: decoded.tokenSupport,
+ token: true,
+ regular: false,
+ }[addressDisplayMode.value];
+ const encoded = lockingBytecodeToCashAddress({ ...decoded, tokenSupport });
+ if (typeof encoded === "string") return address;
+ return opts?.removePrefix === false
+ ? encoded.address
+ : removeAddressPrefix(encoded.address);
+}
diff --git a/src/pages/settings/index.vue b/src/pages/settings/index.vue
index 47d5a0e..88c300a 100644
--- a/src/pages/settings/index.vue
+++ b/src/pages/settings/index.vue
@@ -72,66 +72,7 @@
{{ $t("address_display_format") }}
-
-
-
-
-
+
@@ -145,6 +86,5 @@
diff --git a/src/pages/token/[category].vue b/src/pages/token/[category].vue
index 2004223..a412c99 100644
--- a/src/pages/token/[category].vue
+++ b/src/pages/token/[category].vue
@@ -188,7 +188,9 @@ const tokenInfo = computed(() => {
? null
: Number(reservedSupply.value);
const ownerAddress =
- lockingBytecode && formatLockingBytecodeAddress(lockingBytecode);
+ lockingBytecode && formatLockingBytecodeAddress(lockingBytecode, {
+ tokenCategory: `\\x${category.value}`,
+ });
const items: contentWarpItem[] = [
{
diff --git a/tests/address-components.test.ts b/tests/address-components.test.ts
new file mode 100644
index 0000000..0a32844
--- /dev/null
+++ b/tests/address-components.test.ts
@@ -0,0 +1,26 @@
+import { expect, test } from "bun:test";
+import { fileURLToPath } from "node:url";
+
+test("Vue address integration regressions", async () => {
+ // Nuxt composables are process globals in these Bun tests. Isolate the Vue
+ // compiler and network stubs from the existing store and USD-price tests.
+ const fixture = fileURLToPath(
+ new URL("./fixtures/address-components.ts", import.meta.url),
+ );
+ const child = Bun.spawn([process.execPath, "test", fixture], {
+ stdout: "pipe",
+ stderr: "pipe",
+ });
+ const [stdout, stderr, exitCode] = await Promise.all([
+ new Response(child.stdout).text(),
+ new Response(child.stderr).text(),
+ child.exited,
+ ]);
+ expect({
+ exitCode,
+ output: exitCode === 0 ? "passed" : stdout + stderr,
+ }).toEqual({
+ exitCode: 0,
+ output: "passed",
+ });
+});
diff --git a/tests/address-display.test.ts b/tests/address-display.test.ts
new file mode 100644
index 0000000..df20807
--- /dev/null
+++ b/tests/address-display.test.ts
@@ -0,0 +1,237 @@
+import { afterAll, beforeEach, describe, expect, test } from "bun:test";
+import {
+ binToHex,
+ cashAddressToLockingBytecode,
+ encodeBase58Address,
+ hexToBin,
+} from "@bitauth/libauth";
+import { createPinia, setActivePinia } from "pinia";
+import { computed, effectScope, nextTick, ref, watch } from "vue";
+
+Object.assign(globalThis, {
+ computed,
+ ref,
+ watch,
+ gql: (source: string) => source,
+ useSubscription: () => ({ result: ref() }),
+});
+const {
+ addressDisplayMode,
+ formatLockingBytecodeAddress,
+ formatUtxoAddress,
+ normalizeDisplayAddress,
+ useAddressDisplayPreference,
+} = await import("../src/hooks/addressDisplay");
+const { useStateStore } = await import("../src/store/state");
+
+const scripts = [
+ { bytecode: `76a914${"12".repeat(20)}88ac`, label: "P2PKH" },
+ { bytecode: `a914${"12".repeat(20)}87`, label: "P2SH" },
+ { bytecode: `aa20${"12".repeat(32)}87`, label: "P2SH" },
+] as const;
+const category = `\\x${"34".repeat(32)}` as const;
+const holdings = [
+ { name: "BCH only", token_category: null, fungible_token_amount: "0" },
+ { name: "missing category", fungible_token_amount: "500" },
+ { name: "FT", token_category: category, fungible_token_amount: "100" },
+ {
+ name: "NFT without FTs",
+ token_category: category,
+ fungible_token_amount: "0",
+ nonfungible_token_capability: "none",
+ nonfungible_token_commitment: "\\x",
+ },
+];
+
+beforeEach(() => {
+ setActivePinia(createPinia());
+ addressDisplayMode.value = "auto";
+});
+
+for (const mode of ["auto", "token", "regular"] as const) {
+ for (const network of ["mainnet", "chipnet"] as const) {
+ for (const { bytecode, label } of scripts) {
+ for (const holding of holdings) {
+ test(`${mode} ${network} ${bytecode.slice(0, 6)} ${holding.name}`, () => {
+ addressDisplayMode.value = mode;
+ useStateStore().network = network;
+ const output = { ...holding, locking_bytecode: `\\x${bytecode}` };
+ const result = formatUtxoAddress(output);
+ expect(result).toBeDefined();
+ if (!result) throw new Error("Expected a supported address");
+ const decoded = cashAddressToLockingBytecode(result.fullAddress);
+ if (typeof decoded === "string") throw new Error(decoded);
+ expect(binToHex(decoded.bytecode)).toBe(bytecode);
+ expect(decoded.prefix).toBe(
+ network === "mainnet" ? "bitcoincash" : "bchtest",
+ );
+ expect(decoded.tokenSupport).toBe(
+ mode === "token" ||
+ (mode === "auto" && Boolean(output.token_category)),
+ );
+ // Script labels must never imply token holdings, even under override.
+ expect(result.addressType).toBe(label);
+ expect(
+ formatUtxoAddress({ ...output, locking_bytecode: bytecode }),
+ ).toEqual(result);
+
+ // Copy text and the link destination lead to the same full QR payload.
+ const destination = result.url.slice("/address/".length);
+ expect(destination).toBe(result.address);
+ expect(
+ normalizeDisplayAddress(destination, { removePrefix: false }),
+ ).toBe(result.fullAddress);
+ expect(normalizeDisplayAddress(destination)).toBe(result.address);
+ });
+ }
+ }
+ }
+}
+
+test("the same address can have independent BCH-only and token UTXOs", () => {
+ const locking_bytecode = scripts[0].bytecode;
+ const token = formatUtxoAddress({
+ locking_bytecode,
+ token_category: category,
+ });
+ const regular = formatUtxoAddress({ locking_bytecode });
+ expect(regular?.address).not.toBe(token?.address);
+ expect(formatUtxoAddress({ locking_bytecode })).toEqual(regular);
+ expect(formatLockingBytecodeAddress(locking_bytecode)).toBe(regular?.address);
+ const reactiveAddress = computed(() =>
+ formatUtxoAddress({ locking_bytecode }),
+ );
+ expect(reactiveAddress.value).toEqual(regular);
+ addressDisplayMode.value = "token";
+ expect(reactiveAddress.value).toEqual(token);
+ addressDisplayMode.value = "auto";
+ expect(reactiveAddress.value).toEqual(regular);
+});
+
+test("address pages retain the incoming network and encoding independently of selected network", () => {
+ useStateStore().network = "chipnet";
+ const source = formatUtxoAddress({
+ locking_bytecode: scripts[2].bytecode,
+ token_category: category,
+ });
+ if (!source) throw new Error("Expected P2SH32 address");
+ useStateStore().network = "mainnet";
+ expect(normalizeDisplayAddress(source.address, { removePrefix: false })).toBe(
+ source.fullAddress,
+ );
+ addressDisplayMode.value = "regular";
+ const regular = cashAddressToLockingBytecode(
+ normalizeDisplayAddress(source.address, { removePrefix: false }),
+ );
+ if (typeof regular === "string") throw new Error(regular);
+ expect(regular.prefix).toBe("bchtest");
+ expect(regular.tokenSupport).toBe(false);
+ expect(binToHex(regular.bytecode)).toBe(scripts[2].bytecode);
+});
+
+for (const type of [
+ "p2pkh",
+ "p2pkhTestnet",
+ "p2sh20",
+ "p2sh20Testnet",
+] as const) {
+ test(`legacy ${type} becomes regular CashAddr on its original network`, () => {
+ const legacy = encodeBase58Address(type, hexToBin("12".repeat(20)));
+ const fullAddress = normalizeDisplayAddress(legacy, {
+ removePrefix: false,
+ });
+ const decoded = cashAddressToLockingBytecode(fullAddress);
+ if (typeof decoded === "string") throw new Error(decoded);
+ expect(decoded.prefix).toBe(
+ type.endsWith("Testnet") ? "bchtest" : "bitcoincash",
+ );
+ expect(decoded.tokenSupport).toBe(false);
+ addressDisplayMode.value = "token";
+ const token = cashAddressToLockingBytecode(
+ normalizeDisplayAddress(legacy, { removePrefix: false }),
+ );
+ if (typeof token === "string") throw new Error(token);
+ expect(binToHex(token.bytecode)).toBe(binToHex(decoded.bytecode));
+ expect(token.prefix).toBe(decoded.prefix);
+ expect(token.tokenSupport).toBe(true);
+ });
+}
+
+test("unsupported locking bytecode never becomes an address or link", () => {
+ for (const locking_bytecode of ["", "6a", "\\x6a", "51"]) {
+ expect(formatUtxoAddress({ locking_bytecode })).toBeUndefined();
+ }
+});
+
+describe("browser preference migration", () => {
+ const previousWindow = Object.getOwnPropertyDescriptor(globalThis, "window");
+ const previousStorage = Object.getOwnPropertyDescriptor(
+ globalThis,
+ "localStorage",
+ );
+ const values = new Map
();
+ const storage = {
+ getItem: (key: string) => values.get(key) ?? null,
+ setItem: (key: string, value: string) => values.set(key, value),
+ };
+
+ afterAll(() => {
+ for (const [key, descriptor] of [
+ ["window", previousWindow],
+ ["localStorage", previousStorage],
+ ] as const) {
+ if (descriptor) Object.defineProperty(globalThis, key, descriptor);
+ else Reflect.deleteProperty(globalThis, key);
+ }
+ });
+
+ for (const saved of [
+ undefined,
+ '"auto"',
+ '"token"',
+ '"regular"',
+ "token",
+ "regular",
+ '"invalid"',
+ "broken-json{",
+ "null",
+ "false",
+ "42",
+ "{}",
+ "[]",
+ ]) {
+ test(`validates and persists saved value ${saved}`, async () => {
+ values.clear();
+ Object.assign(globalThis, {
+ window: { localStorage: storage },
+ localStorage: storage,
+ });
+ if (saved !== undefined) values.set("addressDisplayMode", saved);
+ const scope = effectScope();
+ try {
+ const preference = scope.run(useAddressDisplayPreference);
+ if (!preference) throw new Error("Expected a preference ref");
+ const expected =
+ saved === '"token"' || saved === "token"
+ ? "token"
+ : saved === '"regular"' || saved === "regular"
+ ? "regular"
+ : "auto";
+ expect(preference.value).toBe(expected);
+ await nextTick();
+ if (saved !== undefined && expected === "auto" && saved !== '"auto"') {
+ expect(values.get("addressDisplayMode")).toBe('"auto"');
+ }
+ preference.value = expected === "token" ? "regular" : "token";
+ await nextTick();
+ expect(values.get("addressDisplayMode")).toBe(
+ JSON.stringify(preference.value),
+ );
+ const reloaded = scope.run(useAddressDisplayPreference);
+ expect(reloaded?.value).toBe(preference.value);
+ } finally {
+ scope.stop();
+ }
+ });
+ }
+});
diff --git a/tests/fixtures/address-components.ts b/tests/fixtures/address-components.ts
new file mode 100644
index 0000000..5a4131d
--- /dev/null
+++ b/tests/fixtures/address-components.ts
@@ -0,0 +1,180 @@
+import { beforeEach, expect, test } from "bun:test";
+import { readFileSync } from "node:fs";
+import { cashAddressToLockingBytecode } from "@bitauth/libauth";
+import { compileScript, parse } from "@vue/compiler-sfc";
+import { renderToString } from "@vue/server-renderer";
+import { plugin } from "bun";
+import { createPinia, setActivePinia } from "pinia";
+import {
+ computed,
+ createSSRApp,
+ defineComponent,
+ h,
+ onBeforeUnmount,
+ onMounted,
+ reactive,
+ ref,
+ shallowReactive,
+ useId,
+ watch,
+} from "vue";
+
+// Compile the actual Vue components, rather than duplicating their mapping logic.
+plugin({
+ name: "vue-address-regressions",
+ setup(build) {
+ build.onLoad({ filter: /\.vue$/ }, ({ path }) => {
+ const { descriptor } = parse(readFileSync(path, "utf8"), {
+ filename: path,
+ });
+ const script = compileScript(descriptor, {
+ id: path,
+ inlineTemplate: true,
+ });
+ return { contents: script.content, loader: "ts" };
+ });
+ },
+});
+Object.assign(globalThis, {
+ computed,
+ ref,
+ reactive,
+ shallowReactive,
+ watch,
+ onMounted,
+ onBeforeUnmount,
+ useId,
+ gql: (source: string) => source,
+ useSubscription: () => ({ result: ref() }),
+ useQuery: () => ({ onResult: () => undefined }),
+ useFetch: () => ({ data: ref() }),
+});
+const { addressDisplayMode } = await import("../../src/hooks/addressDisplay");
+const { default: TransactionList } = await import(
+ "../../src/components/Transaction/TransactionList.vue"
+);
+const { default: TransactionListOperation } = await import(
+ "../../src/components/Transaction/TransactionListOperation.vue"
+);
+const { default: AddressHeader } = await import(
+ "../../src/components/address/AddressHeader.vue"
+);
+const { default: AddressFormatSettings } = await import(
+ "../../src/components/AddressFormatSettings.vue"
+);
+
+const locking_bytecode = `\\x76a914${"12".repeat(20)}88ac`;
+const category = `\\x${"34".repeat(32)}` as const;
+const bch = { locking_bytecode, value_satoshis: "1000", token_category: null };
+const nft = {
+ ...bch,
+ token_category: category,
+ fungible_token_amount: "0",
+ nonfungible_token_capability: "none" as const,
+ nonfungible_token_commitment: "\\x" as const,
+};
+
+beforeEach(() => {
+ setActivePinia(createPinia());
+ addressDisplayMode.value = "auto";
+});
+
+for (const mode of ["auto", "token", "regular"] as const) {
+ for (const direction of ["spend NFT", "receive FT"] as const) {
+ test(`actual transaction copy, link and destination QR stay consistent: ${mode}, ${direction}`, async () => {
+ addressDisplayMode.value = mode;
+ const copies: { text: string; url?: string; copy: boolean }[] = [];
+ const qrPayloads: string[] = [];
+ const app = createSSRApp(TransactionList, {
+ transactions: [
+ {
+ hash: `\\x${"56".repeat(32)}`,
+ is_coinbase: false,
+ // Same script, different token data on the spent and created output.
+ inputs: [{ outpoint: direction === "spend NFT" ? nft : bch }],
+ outputs: [
+ direction === "spend NFT"
+ ? bch
+ : { ...nft, fungible_token_amount: "100" },
+ { locking_bytecode: "\\x6a0161", value_satoshis: "0" },
+ ],
+ },
+ ],
+ });
+ app.config.globalProperties.$t = (key: string) => key;
+ app.component("TransactionListOperation", TransactionListOperation);
+ app.component(
+ "SliderUpDown",
+ defineComponent({
+ props: { active: Boolean },
+ setup:
+ (_, { slots }) =>
+ () =>
+ slots.default?.(),
+ }),
+ );
+ app.component(
+ "TransactionOperationToken",
+ defineComponent({ setup: () => () => null }),
+ );
+ const Copy = defineComponent({
+ props: {
+ text: { type: String, default: "" },
+ url: String,
+ copy: Boolean,
+ },
+ setup(props) {
+ copies.push({ text: props.text, url: props.url, copy: props.copy });
+ return () => h("span", props.text);
+ },
+ });
+ app.component("BaseCopy", Copy);
+ await renderToString(app);
+ const addresses = copies.filter(({ url }) =>
+ url?.startsWith("/address/"),
+ );
+ expect(addresses).toHaveLength(4); // two summaries and two expanded rows
+ const inputSupport =
+ mode === "token" || (mode === "auto" && direction === "spend NFT");
+ const outputSupport =
+ mode === "token" || (mode === "auto" && direction === "receive FT");
+ const expectedSupport = [
+ inputSupport,
+ outputSupport,
+ inputSupport,
+ outputSupport,
+ ];
+ for (const [index, copy] of addresses.entries()) {
+ expect(copy.url).toBe(`/address/${copy.text}`);
+ const destination = createSSRApp(AddressHeader, { address: copy.text });
+ destination.component("BaseCopy", Copy);
+ destination.component(
+ "VueQrCode",
+ defineComponent({
+ props: { content: { type: String, required: true } },
+ setup(props) {
+ qrPayloads.push(props.content);
+ return () => null;
+ },
+ }),
+ );
+ await renderToString(destination);
+ const decoded = cashAddressToLockingBytecode(qrPayloads[index] || "");
+ if (typeof decoded === "string") throw new Error(decoded);
+ expect(decoded.tokenSupport).toBe(expectedSupport[index] === true);
+ expect(copies.at(-1)?.text).toBe(copy.text);
+ }
+ expect(addresses.slice(2).every(({ copy }) => copy)).toBe(true);
+ });
+ }
+}
+
+test("settings render three native radio choices with the effective preference selected", async () => {
+ for (const mode of ["auto", "token", "regular"] as const) {
+ addressDisplayMode.value = mode;
+ const html = await renderToString(createSSRApp(AddressFormatSettings));
+ expect(html.match(/type="radio"/g)).toHaveLength(3);
+ expect(html.match(/ checked/g)).toHaveLength(1);
+ expect(html.match(/]+checked>/)?.[0]).toContain(`value="${mode}"`);
+ }
+});