Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: add test for appflowy_editor attributes (#1931)

GouravShDev675c833f070c
diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/attributes_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/attributes_test.dart
index 873ab2788b..a7b2349944 100644
--- a/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/attributes_test.dart
+++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/attributes_test.dart
@@ -54,6 +54,37 @@ void main() async {
'b': 3,
'c': 4,
});
+ expect(invertAttributes(null, base), {
+ 'a': null,
+ 'b': null,
+ });
+ expect(invertAttributes(other, null), {
+ 'b': 3,
+ 'c': 4,
+ });
});
+ test(
+ "hasAttributes",
+ () {
+ final base = {
+ 'a': 1,
+ 'b': 2,
+ };
+ final other = {
+ 'c': 3,
+ 'd': 4,
+ };
+
+ var x = hashAttributes(base);
+ var y = hashAttributes(base);
+ // x & y should have same hash code
+ expect(x == y, true);
+
+ y = hashAttributes(other);
+
+ // x & y should have different hash code
+ expect(x == y, false);
+ },
+ );
});
}