This commit is contained in:
jsingleton20
2023-01-30 15:11:09 -05:00
parent 370d0c138d
commit 100e051c5d
66 changed files with 50407 additions and 110 deletions

4
dist/tests/compatibility.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export function testArrayCompatibilityV1(tc: t.TestCase): void;
export function testMapDecodingCompatibilityV1(tc: t.TestCase): void;
export function testTextDecodingCompatibilityV1(tc: t.TestCase): void;
import * as t from "lib0/testing";

10
dist/tests/doc.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
export function testOriginInTransaction(_tc: t.TestCase): void;
export function testClientIdDuplicateChange(tc: t.TestCase): void;
export function testGetTypeEmptyId(tc: t.TestCase): void;
export function testToJSON(tc: t.TestCase): void;
export function testSubdoc(tc: t.TestCase): void;
export function testSubdocLoadEdgeCases(tc: t.TestCase): void;
export function testSubdocLoadEdgeCasesAutoload(tc: t.TestCase): void;
export function testSubdocsUndo(tc: t.TestCase): void;
export function testLoadDocs(tc: t.TestCase): Promise<void>;
import * as t from "lib0/testing";

5
dist/tests/encoding.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
export function testStructReferences(tc: t.TestCase): void;
export function testPermanentUserData(tc: t.TestCase): Promise<void>;
export function testDiffStateVectorOfUpdateIsEmpty(tc: t.TestCase): void;
export function testDiffStateVectorOfUpdateIgnoresSkips(tc: t.TestCase): void;
import * as t from "lib0/testing";

1
dist/tests/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,8 @@
export function testRelativePositionCase1(tc: t.TestCase): void;
export function testRelativePositionCase2(tc: t.TestCase): void;
export function testRelativePositionCase3(tc: t.TestCase): void;
export function testRelativePositionCase4(tc: t.TestCase): void;
export function testRelativePositionCase5(tc: t.TestCase): void;
export function testRelativePositionCase6(tc: t.TestCase): void;
export function testRelativePositionAssociationDifference(tc: t.TestCase): void;
import * as t from "lib0/testing";

9
dist/tests/snapshot.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
export function testBasicRestoreSnapshot(tc: t.TestCase): void;
export function testEmptyRestoreSnapshot(tc: t.TestCase): void;
export function testRestoreSnapshotWithSubType(tc: t.TestCase): void;
export function testRestoreDeletedItem1(tc: t.TestCase): void;
export function testRestoreLeftItem(tc: t.TestCase): void;
export function testDeletedItemsBase(tc: t.TestCase): void;
export function testDeletedItems2(tc: t.TestCase): void;
export function testDependentChanges(tc: t.TestCase): void;
import * as t from "lib0/testing";

161
dist/tests/testHelper.d.ts vendored Normal file
View File

@@ -0,0 +1,161 @@
export * from "../src/index.js";
export let useV2: boolean;
export namespace encV1 {
const encodeStateAsUpdate: (doc: Y.Doc, encodedTargetStateVector?: Uint8Array | undefined) => Uint8Array;
const mergeUpdates: (updates: Uint8Array[]) => Uint8Array;
const applyUpdate: (ydoc: Y.Doc, update: Uint8Array, transactionOrigin?: any) => void;
const logUpdate: (update: Uint8Array) => void;
const updateEventName: string;
const diffUpdate: (update: Uint8Array, sv: Uint8Array) => Uint8Array;
}
export namespace encV2 {
const encodeStateAsUpdate_1: (doc: Y.Doc, encodedTargetStateVector?: Uint8Array | undefined, encoder?: import("../src/internals").UpdateEncoderV2 | Y.UpdateEncoderV1 | undefined) => Uint8Array;
export { encodeStateAsUpdate_1 as encodeStateAsUpdate };
const mergeUpdates_1: (updates: Uint8Array[], YDecoder?: typeof import("../src/internals").UpdateDecoderV1 | typeof import("../src/internals").UpdateDecoderV2 | undefined, YEncoder?: typeof import("../src/internals").UpdateEncoderV2 | typeof Y.UpdateEncoderV1 | undefined) => Uint8Array;
export { mergeUpdates_1 as mergeUpdates };
const applyUpdate_1: (ydoc: Y.Doc, update: Uint8Array, transactionOrigin?: any, YDecoder?: typeof import("../src/internals").UpdateDecoderV1 | typeof import("../src/internals").UpdateDecoderV2 | undefined) => void;
export { applyUpdate_1 as applyUpdate };
const logUpdate_1: (update: Uint8Array, YDecoder?: typeof import("../src/internals").UpdateDecoderV1 | typeof import("../src/internals").UpdateDecoderV2 | undefined) => void;
export { logUpdate_1 as logUpdate };
const updateEventName_1: string;
export { updateEventName_1 as updateEventName };
const diffUpdate_1: (update: Uint8Array, sv: Uint8Array, YDecoder?: typeof import("../src/internals").UpdateDecoderV1 | typeof import("../src/internals").UpdateDecoderV2 | undefined, YEncoder?: typeof import("../src/internals").UpdateEncoderV2 | typeof Y.UpdateEncoderV1 | undefined) => Uint8Array;
export { diffUpdate_1 as diffUpdate };
}
export namespace enc { }
export class TestYInstance extends Y.Doc {
/**
* @param {TestConnector} testConnector
* @param {number} clientID
*/
constructor(testConnector: TestConnector, clientID: number);
userID: number;
/**
* @type {TestConnector}
*/
tc: TestConnector;
/**
* @type {Map<TestYInstance, Array<Uint8Array>>}
*/
receiving: Map<TestYInstance, Array<Uint8Array>>;
/**
* The list of received updates.
* We are going to merge them later using Y.mergeUpdates and check if the resulting document is correct.
* @type {Array<Uint8Array>}
*/
updates: Array<Uint8Array>;
/**
* Disconnect from TestConnector.
*/
disconnect(): void;
/**
* Append yourself to the list of known Y instances in testconnector.
* Also initiate sync with all clients.
*/
connect(): void;
/**
* Receive a message from another client. This message is only appended to the list of receiving messages.
* TestConnector decides when this client actually reads this message.
*
* @param {Uint8Array} message
* @param {TestYInstance} remoteClient
*/
_receive(message: Uint8Array, remoteClient: TestYInstance): void;
}
/**
* Keeps track of TestYInstances.
*
* The TestYInstances add/remove themselves from the list of connections maiained in this object.
* I think it makes sense. Deal with it.
*/
export class TestConnector {
/**
* @param {prng.PRNG} gen
*/
constructor(gen: prng.PRNG);
/**
* @type {Set<TestYInstance>}
*/
allConns: Set<TestYInstance>;
/**
* @type {Set<TestYInstance>}
*/
onlineConns: Set<TestYInstance>;
/**
* @type {prng.PRNG}
*/
prng: prng.PRNG;
/**
* Create a new Y instance and add it to the list of connections
* @param {number} clientID
*/
createY(clientID: number): TestYInstance;
/**
* Choose random connection and flush a random message from a random sender.
*
* If this function was unable to flush a message, because there are no more messages to flush, it returns false. true otherwise.
* @return {boolean}
*/
flushRandomMessage(): boolean;
/**
* @return {boolean} True iff this function actually flushed something
*/
flushAllMessages(): boolean;
reconnectAll(): void;
disconnectAll(): void;
syncAll(): void;
/**
* @return {boolean} Whether it was possible to disconnect a randon connection.
*/
disconnectRandom(): boolean;
/**
* @return {boolean} Whether it was possible to reconnect a random connection.
*/
reconnectRandom(): boolean;
}
export function init<T>(tc: t.TestCase, { users }?: {
users?: number;
}, initTestObject?: InitTestObjectCallback<T> | undefined): {
testObjects: Array<any>;
testConnector: TestConnector;
users: Array<TestYInstance>;
array0: Y.Array<any>;
array1: Y.Array<any>;
array2: Y.Array<any>;
map0: Y.Map<any>;
map1: Y.Map<any>;
map2: Y.Map<any>;
map3: Y.Map<any>;
text0: Y.Text;
text1: Y.Text;
text2: Y.Text;
xml0: Y.XmlElement;
xml1: Y.XmlElement;
xml2: Y.XmlElement;
};
export function compare(users: Array<TestYInstance>): void;
export function compareItemIDs(a: Y.Item | null, b: Y.Item | null): boolean;
export function compareStructStores(ss1: import('../src/internals').StructStore, ss2: import('../src/internals').StructStore): undefined;
export function compareDS(ds1: import('../src/internals').DeleteSet, ds2: import('../src/internals').DeleteSet): void;
export function applyRandomTests<T>(tc: t.TestCase, mods: ((arg0: Y.Doc, arg1: prng.PRNG, arg2: T) => void)[], iterations: number, initTestObject?: InitTestObjectCallback<T> | undefined): {
testObjects: Array<any>;
testConnector: TestConnector;
users: Array<TestYInstance>;
array0: Y.Array<any>;
array1: Y.Array<any>;
array2: Y.Array<any>;
map0: Y.Map<any>;
map1: Y.Map<any>;
map2: Y.Map<any>;
map3: Y.Map<any>;
text0: Y.Text;
text1: Y.Text;
text2: Y.Text;
xml0: Y.XmlElement;
xml1: Y.XmlElement;
xml2: Y.XmlElement;
};
export type InitTestObjectCallback<T> = (y: TestYInstance) => T;
import * as Y from "../src/index.js";
import * as prng from "lib0/prng";
import * as t from "lib0/testing";

21
dist/tests/undo-redo.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,21 @@
export function testInfiniteCaptureTimeout(tc: t.TestCase): void;
export function testUndoText(tc: t.TestCase): void;
export function testEmptyTypeScope(tc: t.TestCase): void;
export function testDoubleUndo(tc: t.TestCase): void;
export function testUndoMap(tc: t.TestCase): void;
export function testUndoArray(tc: t.TestCase): void;
export function testUndoXml(tc: t.TestCase): void;
export function testUndoEvents(tc: t.TestCase): void;
export function testTrackClass(tc: t.TestCase): void;
export function testTypeScope(tc: t.TestCase): void;
export function testUndoInEmbed(tc: t.TestCase): void;
export function testUndoDeleteFilter(tc: t.TestCase): void;
export function testUndoUntilChangePerformed(tc: t.TestCase): void;
export function testUndoNestedUndoIssue(tc: t.TestCase): void;
export function testConsecutiveRedoBug(tc: t.TestCase): void;
export function testUndoXmlBug(tc: t.TestCase): void;
export function testUndoBlockBug(tc: t.TestCase): void;
export function testUndoDeleteTextFormat(tc: t.TestCase): void;
export function testBehaviorOfIgnoreremotemapchangesProperty(tc: t.TestCase): void;
export function testSpecialDeletionCase(tc: t.TestCase): void;
import * as t from "lib0/testing";

22
dist/tests/updates.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
export function testMergeUpdates(tc: t.TestCase): void;
export function testKeyEncoding(tc: t.TestCase): void;
export function testMergeUpdates1(tc: t.TestCase): void;
export function testMergeUpdates2(tc: t.TestCase): void;
export function testMergePendingUpdates(tc: t.TestCase): void;
export type Enc = {
mergeUpdates: (arg0: Array<Uint8Array>) => Uint8Array;
encodeStateAsUpdate: (arg0: Y.Doc) => Uint8Array;
applyUpdate: (arg0: Y.Doc, arg1: Uint8Array) => void;
logUpdate: (arg0: Uint8Array) => void;
parseUpdateMeta: (arg0: Uint8Array) => {
from: Map<number, number>;
to: Map<number, number>;
};
encodeStateVector: (arg0: Y.Doc) => Uint8Array;
encodeStateVectorFromUpdate: (arg0: Uint8Array) => Uint8Array;
updateEventName: string;
description: string;
diffUpdate: (arg0: Uint8Array, arg1: Uint8Array) => Uint8Array;
};
import * as t from "lib0/testing";
import * as Y from "../src/index.js";

41
dist/tests/y-array.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
export function testBasicUpdate(tc: t.TestCase): void;
export function testSlice(tc: t.TestCase): void;
export function testArrayFrom(tc: t.TestCase): void;
export function testLengthIssue(tc: t.TestCase): void;
export function testLengthIssue2(tc: t.TestCase): void;
export function testDeleteInsert(tc: t.TestCase): void;
export function testInsertThreeElementsTryRegetProperty(tc: t.TestCase): void;
export function testConcurrentInsertWithThreeConflicts(tc: t.TestCase): void;
export function testConcurrentInsertDeleteWithThreeConflicts(tc: t.TestCase): void;
export function testInsertionsInLateSync(tc: t.TestCase): void;
export function testDisconnectReallyPreventsSendingMessages(tc: t.TestCase): void;
export function testDeletionsInLateSync(tc: t.TestCase): void;
export function testInsertThenMergeDeleteOnSync(tc: t.TestCase): void;
export function testInsertAndDeleteEvents(tc: t.TestCase): void;
export function testNestedObserverEvents(tc: t.TestCase): void;
export function testInsertAndDeleteEventsForTypes(tc: t.TestCase): void;
export function testObserveDeepEventOrder(tc: t.TestCase): void;
export function testChangeEvent(tc: t.TestCase): void;
export function testInsertAndDeleteEventsForTypes2(tc: t.TestCase): void;
export function testNewChildDoesNotEmitEventInTransaction(tc: t.TestCase): void;
export function testGarbageCollector(tc: t.TestCase): void;
export function testEventTargetIsSetCorrectlyOnLocal(tc: t.TestCase): void;
export function testEventTargetIsSetCorrectlyOnRemote(tc: t.TestCase): void;
export function testIteratingArrayContainingTypes(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests6(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests40(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests42(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests43(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests44(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests45(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests46(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests300(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests400(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests500(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests600(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests1000(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests1800(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests3000(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests5000(tc: t.TestCase): void;
export function testRepeatGeneratingYarrayTests30000(tc: t.TestCase): void;
import * as t from "lib0/testing";

38
dist/tests/y-map.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,38 @@
export function testMapHavingIterableAsConstructorParamTests(tc: t.TestCase): void;
export function testBasicMapTests(tc: t.TestCase): void;
export function testGetAndSetOfMapProperty(tc: t.TestCase): void;
export function testYmapSetsYmap(tc: t.TestCase): void;
export function testYmapSetsYarray(tc: t.TestCase): void;
export function testGetAndSetOfMapPropertySyncs(tc: t.TestCase): void;
export function testGetAndSetOfMapPropertyWithConflict(tc: t.TestCase): void;
export function testSizeAndDeleteOfMapProperty(tc: t.TestCase): void;
export function testGetAndSetAndDeleteOfMapProperty(tc: t.TestCase): void;
export function testSetAndClearOfMapProperties(tc: t.TestCase): void;
export function testSetAndClearOfMapPropertiesWithConflicts(tc: t.TestCase): void;
export function testGetAndSetOfMapPropertyWithThreeConflicts(tc: t.TestCase): void;
export function testGetAndSetAndDeleteOfMapPropertyWithThreeConflicts(tc: t.TestCase): void;
export function testObserveDeepProperties(tc: t.TestCase): void;
export function testObserversUsingObservedeep(tc: t.TestCase): void;
export function testThrowsAddAndUpdateAndDeleteEvents(tc: t.TestCase): void;
export function testThrowsDeleteEventsOnClear(tc: t.TestCase): void;
export function testChangeEvent(tc: t.TestCase): void;
export function testYmapEventExceptionsShouldCompleteTransaction(tc: t.TestCase): void;
export function testYmapEventHasCorrectValueWhenSettingAPrimitive(tc: t.TestCase): void;
export function testYmapEventHasCorrectValueWhenSettingAPrimitiveFromOtherUser(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests10(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests40(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests42(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests43(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests44(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests45(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests46(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests300(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests400(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests500(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests600(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests1000(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests1800(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests5000(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests10000(tc: t.TestCase): void;
export function testRepeatGeneratingYmapTests100000(tc: t.TestCase): void;
import * as t from "lib0/testing";

42
dist/tests/y-text.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,42 @@
export function testDeltaAfterConcurrentFormatting(tc: t.TestCase): void;
export function testBasicInsertAndDelete(tc: t.TestCase): void;
export function testBasicFormat(tc: t.TestCase): void;
export function testMultilineFormat(tc: t.TestCase): void;
export function testNotMergeEmptyLinesFormat(tc: t.TestCase): void;
export function testPreserveAttributesThroughDelete(tc: t.TestCase): void;
export function testGetDeltaWithEmbeds(tc: t.TestCase): void;
export function testTypesAsEmbed(tc: t.TestCase): void;
export function testSnapshot(tc: t.TestCase): void;
export function testSnapshotDeleteAfter(tc: t.TestCase): void;
export function testToJson(tc: t.TestCase): void;
export function testToDeltaEmbedAttributes(tc: t.TestCase): void;
export function testToDeltaEmbedNoAttributes(tc: t.TestCase): void;
export function testFormattingRemoved(tc: t.TestCase): void;
export function testFormattingRemovedInMidText(tc: t.TestCase): void;
export function testFormattingDeltaUnnecessaryAttributeChange(tc: t.TestCase): void;
export function testInsertAndDeleteAtRandomPositions(tc: t.TestCase): void;
export function testAppendChars(tc: t.TestCase): void;
export function testBestCase(tc: t.TestCase): void;
export function testLargeFragmentedDocument(tc: t.TestCase): void;
export function testIncrementalUpdatesPerformanceOnLargeFragmentedDocument(tc: t.TestCase): void;
export function testSplitSurrogateCharacter(tc: t.TestCase): void;
export function testSearchMarkerBug1(tc: t.TestCase): void;
export function testFormattingBug(tc: t.TestCase): Promise<void>;
export function testDeleteFormatting(tc: t.TestCase): void;
export function testRepeatGenerateTextChanges5(tc: t.TestCase): void;
export function testRepeatGenerateTextChanges30(tc: t.TestCase): void;
export function testRepeatGenerateTextChanges40(tc: t.TestCase): void;
export function testRepeatGenerateTextChanges50(tc: t.TestCase): void;
export function testRepeatGenerateTextChanges70(tc: t.TestCase): void;
export function testRepeatGenerateTextChanges90(tc: t.TestCase): void;
export function testRepeatGenerateTextChanges300(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges1(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges2(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges2Repeat(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges3(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges30(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges40(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges70(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges100(tc: t.TestCase): void;
export function testRepeatGenerateQuillChanges300(tc: t.TestCase): void;
import * as t from "lib0/testing";

10
dist/tests/y-xml.tests.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
export function testSetProperty(tc: t.TestCase): void;
export function testHasProperty(tc: t.TestCase): void;
export function testEvents(tc: t.TestCase): void;
export function testTreewalker(tc: t.TestCase): void;
export function testYtextAttributes(tc: t.TestCase): void;
export function testSiblings(tc: t.TestCase): void;
export function testInsertafter(tc: t.TestCase): void;
export function testClone(tc: t.TestCase): void;
export function testFormattingBug(tc: t.TestCase): void;
import * as t from "lib0/testing";