From e656ad31122bc2331ebbca2f9754f0f02a2d2bf5 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 5 Jul 2024 09:31:18 -0400 Subject: [PATCH] Fix tests broken by document.row change --- src/common/all_test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/all_test.ts b/src/common/all_test.ts index 61d4e5f..1c74ba7 100644 --- a/src/common/all_test.ts +++ b/src/common/all_test.ts @@ -281,7 +281,7 @@ const DocumentTest = { const doc = Document.default(); assertEquals(doc.numRows, 0); assertTrue(doc.isEmpty()); - assertEquals(doc.row(0), null); + assertEquivalent(doc.row(0), None); }, '.open': async () => { const oldDoc = Document.default(); @@ -307,7 +307,7 @@ const DocumentTest = { doc.insertRow(undefined, 'foobar'); assertEquals(doc.numRows, 1); assertFalse(doc.isEmpty()); - assertInstanceOf(doc.row(0), Row); + assertInstanceOf(doc.row(0).unwrap(), Row); }, '.insert': () => { const doc = Document.default(); @@ -350,34 +350,34 @@ const DocumentTest = { doc3.insert(Position.default(), 'foobar'); doc3.insertNewline(Position.at(3, 0)); assertEquals(doc3.numRows, 2); - assertEquals(doc3.row(0)?.toString(), 'foo'); - assertEquals(doc3.row(1)?.toString(), 'bar'); + assertEquals(doc3.row(0).unwrap().toString(), 'foo'); + assertEquals(doc3.row(1).unwrap().toString(), 'bar'); }, '.delete': () => { const doc = Document.default(); doc.insert(Position.default(), 'foobar'); doc.delete(Position.at(3, 0)); - assertEquals(doc.row(0)?.toString(), 'fooar'); + assertEquals(doc.row(0).unwrap().toString(), 'fooar'); // Merge previous row const doc2 = Document.default(); doc2.insertNewline(Position.default()); doc2.insert(Position.at(0, 1), 'foobar'); doc2.delete(Position.at(0, 1)); - assertEquals(doc2.row(0)?.toString(), 'foobar'); + assertEquals(doc2.row(0).unwrap().toString(), 'foobar'); // Merge next row const doc3 = Document.default(); doc3.insertNewline(Position.default()); doc3.insert(Position.at(0, 1), 'foobar'); doc3.delete(Position.at(0, 0)); - assertEquals(doc3.row(0)?.toString(), 'foobar'); + assertEquals(doc3.row(0).unwrap().toString(), 'foobar'); // Invalid delete location const doc4 = Document.default(); doc4.insert(Position.default(), 'foobar'); doc4.delete(Position.at(0, 1)); - assertEquals(doc4.row(0)?.toString(), 'foobar'); + assertEquals(doc4.row(0).unwrap().toString(), 'foobar'); }, };