about summary refs log tree commit diff
path: root/__tests__/lib/strings/rich-text.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-03-31 13:17:26 -0500
committerGitHub <noreply@github.com>2023-03-31 13:17:26 -0500
commita3334a01a221877d3e06e02f960fda441f3460bd (patch)
tree64cdbb1232d1a3c00750c346b6e3ae529b51d1b0 /__tests__/lib/strings/rich-text.ts
parent19f3a2fa92a61ddb785fc4e42d73792c1d0e772c (diff)
downloadvoidsky-a3334a01a221877d3e06e02f960fda441f3460bd.tar.zst
Lex refactor (#362)
* Remove the hackcheck for upgrades

* Rename the PostEmbeds folder to match the codebase style

* Updates to latest lex refactor

* Update to use new bsky agent

* Update to use api package's richtext library

* Switch to upsertProfile

* Add TextEncoder/TextDecoder polyfill

* Add Intl.Segmenter polyfill

* Update composer to calculate lengths by grapheme

* Fix detox

* Fix login in e2e

* Create account e2e passing

* Implement an e2e mocking framework

* Don't use private methods on mobx models as mobx can't track them

* Add tooling for e2e-specific builds and add e2e media-picker mock

* Add some tests and fix some bugs around profile editing

* Add shell tests

* Add home screen tests

* Add thread screen tests

* Add tests for other user profile screens

* Add search screen tests

* Implement profile imagery change tools and tests

* Update to new embed behaviors

* Add post tests

* Fix to profile-screen test

* Fix session resumption

* Update web composer to new api

* 1.11.0

* Fix pagination cursor parameters

* Add quote posts to notifications

* Fix embed layouts

* Remove youtube inline player and improve tap handling on link cards

* Reset minimal shell mode on all screen loads and feed swipes (close #299)

* Update podfile.lock

* Improve post notfound UI (close #366)

* Bump atproto packages
Diffstat (limited to '__tests__/lib/strings/rich-text.ts')
-rw-r--r--__tests__/lib/strings/rich-text.ts123
1 files changed, 0 insertions, 123 deletions
diff --git a/__tests__/lib/strings/rich-text.ts b/__tests__/lib/strings/rich-text.ts
deleted file mode 100644
index e52ac6cec..000000000
--- a/__tests__/lib/strings/rich-text.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-import {RichText} from '../../../src/lib/strings/rich-text'
-
-describe('richText.insert', () => {
-  const input = new RichText('hello world', [
-    {index: {start: 2, end: 7}, type: '', value: ''},
-  ])
-
-  it('correctly adjusts entities (scenario A - before)', () => {
-    const output = input.clone().insert(0, 'test')
-    expect(output.text).toEqual('testhello world')
-    expect(output.entities?.[0].index.start).toEqual(6)
-    expect(output.entities?.[0].index.end).toEqual(11)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual('llo w')
-  })
-
-  it('correctly adjusts entities (scenario B - inner)', () => {
-    const output = input.clone().insert(4, 'test')
-    expect(output.text).toEqual('helltesto world')
-    expect(output.entities?.[0].index.start).toEqual(2)
-    expect(output.entities?.[0].index.end).toEqual(11)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual('lltesto w')
-  })
-
-  it('correctly adjusts entities (scenario C - after)', () => {
-    const output = input.clone().insert(8, 'test')
-    expect(output.text).toEqual('hello wotestrld')
-    expect(output.entities?.[0].index.start).toEqual(2)
-    expect(output.entities?.[0].index.end).toEqual(7)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual('llo w')
-  })
-})
-
-describe('richText.delete', () => {
-  const input = new RichText('hello world', [
-    {index: {start: 2, end: 7}, type: '', value: ''},
-  ])
-
-  it('correctly adjusts entities (scenario A - entirely outer)', () => {
-    const output = input.clone().delete(0, 9)
-    expect(output.text).toEqual('ld')
-    expect(output.entities?.length).toEqual(0)
-  })
-
-  it('correctly adjusts entities (scenario B - entirely after)', () => {
-    const output = input.clone().delete(7, 11)
-    expect(output.text).toEqual('hello w')
-    expect(output.entities?.[0].index.start).toEqual(2)
-    expect(output.entities?.[0].index.end).toEqual(7)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual('llo w')
-  })
-
-  it('correctly adjusts entities (scenario C - partially after)', () => {
-    const output = input.clone().delete(4, 11)
-    expect(output.text).toEqual('hell')
-    expect(output.entities?.[0].index.start).toEqual(2)
-    expect(output.entities?.[0].index.end).toEqual(4)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual('ll')
-  })
-
-  it('correctly adjusts entities (scenario D - entirely inner)', () => {
-    const output = input.clone().delete(3, 5)
-    expect(output.text).toEqual('hel world')
-    expect(output.entities?.[0].index.start).toEqual(2)
-    expect(output.entities?.[0].index.end).toEqual(5)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual('l w')
-  })
-
-  it('correctly adjusts entities (scenario E - partially before)', () => {
-    const output = input.clone().delete(1, 5)
-    expect(output.text).toEqual('h world')
-    expect(output.entities?.[0].index.start).toEqual(1)
-    expect(output.entities?.[0].index.end).toEqual(3)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual(' w')
-  })
-
-  it('correctly adjusts entities (scenario F - entirely before)', () => {
-    const output = input.clone().delete(0, 2)
-    expect(output.text).toEqual('llo world')
-    expect(output.entities?.[0].index.start).toEqual(0)
-    expect(output.entities?.[0].index.end).toEqual(5)
-    expect(
-      output.text.slice(
-        output.entities?.[0].index.start,
-        output.entities?.[0].index.end,
-      ),
-    ).toEqual('llo w')
-  })
-})