Skip to content

Commit

Permalink
Merge pull request #70 from RedAtman/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
RedAtman authored Aug 6, 2024
2 parents d2313f0 + 20c668a commit 4722ac0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 4 additions & 3 deletions commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,10 @@ def callback(self, updated_notes: List[Note]):

sync_times = global_storage.get(CONFIG.SIMPLENOTE_SYNC_TIMES_KEY)
if not isinstance(sync_times, int):
raise TypeError(
"Value of %s must be type %s, got %s" % (CONFIG.SIMPLENOTE_SYNC_TIMES_KEY, int, type(sync_times))
)
global_storage.optimistic_update(CONFIG.SIMPLENOTE_SYNC_TIMES_KEY, 0)
# raise TypeError(
# "Value of %s must be type %s, got %s" % (CONFIG.SIMPLENOTE_SYNC_TIMES_KEY, int, type(sync_times))
# )
first_sync = sync_times == 0
if first_sync:
show_quick_panel(True)
Expand Down
16 changes: 16 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,22 @@ def test__note__nest_dict(self):
assert validate_result.keys() == note.d._nest_dict().keys()
assert "_modificationDate" in note.d.__dict__

def test_get_title_body(self):
list_content = [
# "",
# "SimplenoteTitle",
"SimplenoteTitle\nSimplenoteBody\nheader",
# "SimplenoteTitle\n\nSimplenoteBody\nheader",
"SimplenoteTitle\nSimplenoteBody\n\nheader",
# "SimplenoteTitle\n\nSimplenoteBody\n\nheader",
"SimplenoteTitle\nSimplenoteBody",
# "# SimplenoteTitle\n\nSimplenoteBody",
]
for content in list_content:
title, body = Note.get_title_body(content)
assert title == "SimplenoteTitle"
assert body.startswith("SimplenoteBody")


if __name__ == "__main__":
main()

0 comments on commit 4722ac0

Please sign in to comment.