From 222332bf269cdc845672e1669e719ee0b6b0051a Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Mon, 7 Aug 2023 16:59:20 -0700 Subject: [PATCH] add test superscript_digits --- tests/unit/labels.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/labels.test.ts b/tests/unit/labels.test.ts index 2206b1a..52d5bf5 100644 --- a/tests/unit/labels.test.ts +++ b/tests/unit/labels.test.ts @@ -4,6 +4,7 @@ import { heatmap_keys, pretty_num, property_labels, + superscript_digits, } from '$lib/labels' import { expect, test } from 'vitest' @@ -53,3 +54,10 @@ test(`property_labels are valid element data keys`, () => { const prop_keys = Object.keys(property_labels) expect(element_data_keys).toEqual(expect.arrayContaining(prop_keys)) }) + +test(`superscript_digits`, () => { + expect(superscript_digits(`Cr3+ O2- Ac3+`)).toBe(`Cr³⁺ O²⁻ Ac³⁺`) + expect(superscript_digits(`1234567890`)).toBe(`¹²³⁴⁵⁶⁷⁸⁹⁰`) + expect(superscript_digits(`+123-456+789-0`)).toBe(`⁺¹²³⁻⁴⁵⁶⁺⁷⁸⁹⁻⁰`) + expect(superscript_digits(`No digits here`)).toBe(`No digits here`) +})