Fix tests broken by document.row change
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2024-07-05 09:31:18 -04:00
parent 1cfdeece60
commit e656ad3112

View File

@ -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');
},
};