From 9747ed3d1ee73c10e5ac4079cf2812290967c649 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 16 Nov 2024 22:52:40 +0000 Subject: [PATCH] Insta snaps --- ...__operation__tests__creation_errors-2.snap | 10 +++++ ...__operation__tests__creation_errors-3.snap | 10 +++++ ...__operation__tests__creation_errors-4.snap | 10 +++++ ...__operation__tests__creation_errors-5.snap | 10 +++++ ...ns__operation__tests__creation_errors.snap | 10 +++++ ...sequence__tests__calculate_operations.snap | 37 +++++++++++++++++++ ..._calculate_operations_with_large_diff.snap | 11 ++++++ ...ts__calculate_operations_with_no_diff.snap | 8 ++++ 8 files changed, 106 insertions(+) create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-2.snap create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-3.snap create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-4.snap create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-5.snap create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors.snap create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations.snap create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_large_diff.snap create mode 100644 backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_no_diff.snap diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-2.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-2.snap new file mode 100644 index 0000000..26449e0 --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-2.snap @@ -0,0 +1,10 @@ +--- +source: sync_lib/src/operations/operation.rs +expression: "Operation::create_delete(0, -1)" +snapshot_kind: text +--- +Err( + NegativeOperationIndexError( + "Length -1 is negative", + ), +) diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-3.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-3.snap new file mode 100644 index 0000000..42d4162 --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-3.snap @@ -0,0 +1,10 @@ +--- +source: sync_lib/src/operations/operation.rs +expression: "Operation::create_delete(-1, -1)" +snapshot_kind: text +--- +Err( + NegativeOperationIndexError( + "Index -1 is negative", + ), +) diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-4.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-4.snap new file mode 100644 index 0000000..3fba69b --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-4.snap @@ -0,0 +1,10 @@ +--- +source: sync_lib/src/operations/operation.rs +expression: "Operation::create_insert(0, \"hi\").unwrap().unwrap().with_index(-1)" +snapshot_kind: text +--- +Err( + NegativeOperationIndexError( + "Index -1 is negative", + ), +) diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-5.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-5.snap new file mode 100644 index 0000000..44f3132 --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors-5.snap @@ -0,0 +1,10 @@ +--- +source: sync_lib/src/operations/operation.rs +expression: "Operation::create_insert(1, \"hi\").unwrap().unwrap().with_shifted_index(-2)" +snapshot_kind: text +--- +Err( + NegativeOperationIndexError( + "Index -1 is negative", + ), +) diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors.snap new file mode 100644 index 0000000..621c86f --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation__tests__creation_errors.snap @@ -0,0 +1,10 @@ +--- +source: sync_lib/src/operations/operation.rs +expression: "Operation::create_insert(-1, \"hi\")" +snapshot_kind: text +--- +Err( + NegativeOperationIndexError( + "Index -1 is negative", + ), +) diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations.snap new file mode 100644 index 0000000..795e27f --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations.snap @@ -0,0 +1,37 @@ +--- +source: sync_lib/src/operations/operation_sequence.rs +expression: operations +snapshot_kind: text +--- +OperationSequence { + operations: [ + Delete { + index: 0, + deleted_character_count: 5, + }, + Insert { + index: 0, + text: "Hello,", + }, + Delete { + index: 7, + deleted_character_count: 5, + }, + Insert { + index: 7, + text: "my friend", + }, + Insert { + index: 29, + text: " doing", + }, + Delete { + index: 36, + deleted_character_count: 6, + }, + Insert { + index: 36, + text: " Albert", + }, + ], +} diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_large_diff.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_large_diff.snap new file mode 100644 index 0000000..6086aae --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_large_diff.snap @@ -0,0 +1,11 @@ +--- +source: sync_lib/src/operations/operation_sequence.rs +expression: result +snapshot_kind: text +--- +Err( + DiffTooLarge { + diff_ratio: 0.73333335, + diff_ratio_limit: 0.1, + }, +) diff --git a/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_no_diff.snap b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_no_diff.snap new file mode 100644 index 0000000..a65ae79 --- /dev/null +++ b/backend/sync_lib/src/operations/snapshots/sync_lib__operations__operation_sequence__tests__calculate_operations_with_no_diff.snap @@ -0,0 +1,8 @@ +--- +source: sync_lib/src/operations/operation_sequence.rs +expression: operations +snapshot_kind: text +--- +OperationSequence { + operations: [], +}