Skip to content

Commit

Permalink
add test superscript_digits
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Aug 7, 2023
1 parent 9a52440 commit 222332b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/unit/labels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
heatmap_keys,
pretty_num,
property_labels,
superscript_digits,
} from '$lib/labels'
import { expect, test } from 'vitest'

Expand Down Expand Up @@ -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`)
})

0 comments on commit 222332b

Please sign in to comment.