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(); const doc = Document.default();
assertEquals(doc.numRows, 0); assertEquals(doc.numRows, 0);
assertTrue(doc.isEmpty()); assertTrue(doc.isEmpty());
assertEquals(doc.row(0), null); assertEquivalent(doc.row(0), None);
}, },
'.open': async () => { '.open': async () => {
const oldDoc = Document.default(); const oldDoc = Document.default();
@ -307,7 +307,7 @@ const DocumentTest = {
doc.insertRow(undefined, 'foobar'); doc.insertRow(undefined, 'foobar');
assertEquals(doc.numRows, 1); assertEquals(doc.numRows, 1);
assertFalse(doc.isEmpty()); assertFalse(doc.isEmpty());
assertInstanceOf(doc.row(0), Row); assertInstanceOf(doc.row(0).unwrap(), Row);
}, },
'.insert': () => { '.insert': () => {
const doc = Document.default(); const doc = Document.default();
@ -350,34 +350,34 @@ const DocumentTest = {
doc3.insert(Position.default(), 'foobar'); doc3.insert(Position.default(), 'foobar');
doc3.insertNewline(Position.at(3, 0)); doc3.insertNewline(Position.at(3, 0));
assertEquals(doc3.numRows, 2); assertEquals(doc3.numRows, 2);
assertEquals(doc3.row(0)?.toString(), 'foo'); assertEquals(doc3.row(0).unwrap().toString(), 'foo');
assertEquals(doc3.row(1)?.toString(), 'bar'); assertEquals(doc3.row(1).unwrap().toString(), 'bar');
}, },
'.delete': () => { '.delete': () => {
const doc = Document.default(); const doc = Document.default();
doc.insert(Position.default(), 'foobar'); doc.insert(Position.default(), 'foobar');
doc.delete(Position.at(3, 0)); doc.delete(Position.at(3, 0));
assertEquals(doc.row(0)?.toString(), 'fooar'); assertEquals(doc.row(0).unwrap().toString(), 'fooar');
// Merge previous row // Merge previous row
const doc2 = Document.default(); const doc2 = Document.default();
doc2.insertNewline(Position.default()); doc2.insertNewline(Position.default());
doc2.insert(Position.at(0, 1), 'foobar'); doc2.insert(Position.at(0, 1), 'foobar');
doc2.delete(Position.at(0, 1)); doc2.delete(Position.at(0, 1));
assertEquals(doc2.row(0)?.toString(), 'foobar'); assertEquals(doc2.row(0).unwrap().toString(), 'foobar');
// Merge next row // Merge next row
const doc3 = Document.default(); const doc3 = Document.default();
doc3.insertNewline(Position.default()); doc3.insertNewline(Position.default());
doc3.insert(Position.at(0, 1), 'foobar'); doc3.insert(Position.at(0, 1), 'foobar');
doc3.delete(Position.at(0, 0)); doc3.delete(Position.at(0, 0));
assertEquals(doc3.row(0)?.toString(), 'foobar'); assertEquals(doc3.row(0).unwrap().toString(), 'foobar');
// Invalid delete location // Invalid delete location
const doc4 = Document.default(); const doc4 = Document.default();
doc4.insert(Position.default(), 'foobar'); doc4.insert(Position.default(), 'foobar');
doc4.delete(Position.at(0, 1)); doc4.delete(Position.at(0, 1));
assertEquals(doc4.row(0)?.toString(), 'foobar'); assertEquals(doc4.row(0).unwrap().toString(), 'foobar');
}, },
}; };