livebook/assets/test/lib/text_utils.test.js
Jonatan Kłosko acd100f3d3
Improve intellisense to handle structs and sigils (#513)
* Update Code.Fragment backport

* Support structs completion and show module subtype

* Support sigil completion

* Update changelog

* Don't show completion items for hidden modules

* Update Code.Fragment backport
2021-08-23 10:42:18 +02:00

10 lines
490 B
JavaScript

import { replacedSuffixLength } from "../../js/highlight/text_utils";
test("replacedSuffixLength", () => {
expect(replacedSuffixLength("to_string(", "")).toEqual(0);
expect(replacedSuffixLength("to_string(", "length")).toEqual(0);
expect(replacedSuffixLength("length", "length")).toEqual(6);
expect(replacedSuffixLength("x = ~", "~r")).toEqual(1);
expect(replacedSuffixLength("Enum.ma", "map")).toEqual(2);
expect(replacedSuffixLength("Enum.ma", "map_reduce")).toEqual(2);
});