1
0
mirror of git://jb55.com/damus synced 2024-09-05 21:03:51 +00:00
damus/damusTests
Daniel D’Aquino a1e6be214e Migrate NostrDB files to shared app group file container
This change was made so that NostrDB data can be accessed from different build targets such as the notification service extension.

Upon initialization of NostrDB, it will check both DB file locations (the old documents directory, and the new shared app group container). If it sees the DB is present on the old location, and not on the new location, it will move the files to the new location. In any other condition it will keep the files intact to prevent data loss.

In order to avoid any conflicts between the damusApp's Ndb instance and the extension's Ndb instance when writing or moving the file, a new parameter called "owns_db_file" was added, and set to "false" for the extension. This ensures that the extension will not attempt to move DB files or create a new DB file on its own. Only the main app can move or create the DB file.

Testing
-------

PASS

Device: iPhone 15 Pro simulator
iOS: 17.0.1
Damus: This commit
Steps:
1. Run with the debugger attached to the extension target.
2. Using Apple's push notification testing dashboard, send a test push notification with a real payload (that includes the nostr event under `nostr_event`. Payload generated by strfry-push-notify).
3. Watch logs. It should show a message like "Got push notification from <DISPLAY_NAME>", where `DISPLAY_NAME` is the correct profile name of the user who generated the event. PASS

Regression testing
------------------

Device: iPhone 13 Mini (Real device)
iOS: 17.1.1
Damus: This commit
Other preconditions:
- Damus is at 1.6 (29) at the start of the test
- NostrDB filled with real data on the old location
Steps:
1. Flash (upgrade) the new Damus version (this commit) (This will be the first time upgrading, shared file container is empty)
2. Try to use the app normally. Scroll and navigate to several locations. Interact with some notes. App should be stable, work, and appear to have profile names already (i.e. It shouldn't start with a bunch of npubs in the place of profile names on known contacts). PASS
3. Downgrade back to the App store version (v1.6 (29))
4. Try to use the app normally. Scroll and navigate, interact, etc. App should work and be stable, but profile name cache is expected to be lost (i.e. shows npubs for a bit until profile is reloaded into NostrDB). PASS
5. Upgrade app again to the version in this commit.
6. Repeat step 2. Everything should work as normal and all profiles should be preloaded from the start. PASS

Closes: https://github.com/damus-io/damus/issues/1744
2023-11-21 10:39:27 -08:00
..
__Snapshots__/EventViewTests test: Add basic snapshot test coverage for EventView 2023-10-16 03:13:28 +02:00
Mocking Migrate NostrDB files to shared app group file container 2023-11-21 10:39:27 -08:00
Models Create helper extensions for Block and update tests for the Block helper model 2023-09-03 18:02:32 -07:00
Util test: add text attribute testing function 2023-07-17 10:25:09 -07:00
Bech32Tests.swift ndb: switch to nostrdb notes 2023-08-03 13:20:36 -07:00
ContentParserTests.swift content: add utf8 char at url left boundary test 2023-07-16 11:46:23 -07:00
DamusCacheManagerTests.swift storage: Improve clear cache functionality 2023-10-07 16:42:08 -07:00
damusTests.swift Properly implement top-level tests and fix one test using the wrong Block conversion property 2023-09-03 18:02:32 -07:00
DMTests.swift Fix old notifications always appearing on first start 2023-08-06 09:22:28 -07:00
EventGroupViewTests.swift test: attempt to fix broken tests 2023-11-13 15:03:17 -08:00
EventViewTests.swift tests: disable snapshot tests for now 2023-11-14 07:13:51 -08:00
FormatTests.swift Fix localization issues, add tests, import translations, and add zh-CN and zh-TW 2023-02-24 12:44:54 -08:00
HashtagTests.swift test: add test cases for ASCII and UTF-8 characters in hashtags 2023-09-15 12:31:17 -05:00
InvoiceTests.swift Create helper extensions for Block and update tests for the Block helper model 2023-09-03 18:02:32 -07:00
KeychainStorageTests.swift Replace Vault dependency with @KeychainStorage property wrapper 2023-05-04 15:57:02 -07:00
LikeTests.swift ndb: switch to nostrdb notes 2023-08-03 13:20:36 -07:00
ListTests.swift ndb: switch to nostrdb notes 2023-08-03 13:20:36 -07:00
LocalizationUtilTests.swift Fix localization issues and export strings for translation 2023-07-14 09:34:29 -07:00
LongPostTests.swift tests: add ndb support to tests 2023-09-21 09:10:06 -04:00
NIP19Tests.swift ndb: switch to nostrdb notes 2023-08-03 13:20:36 -07:00
NostrEventTests.swift Fix image links appearing with escaped slashes 2023-08-18 08:41:21 -07:00
NostrScriptTests.swift test: attempt to fix broken tests 2023-11-13 15:03:17 -08:00
NoteContentViewTests.swift tests: add ndb support to tests 2023-09-21 09:10:06 -04:00
PostViewTests.swift tests: disable snapshot tests for now 2023-11-14 07:13:51 -08:00
ProfileViewTests.swift Migrate NostrDB files to shared app group file container 2023-11-21 10:39:27 -08:00
ReplyDescriptionTests.swift Add image uploader 2023-03-15 17:12:05 -06:00
ReplyTests.swift test: attempt to fix broken tests 2023-11-13 15:03:17 -08:00
RequestTests.swift tests: disable invalid tests 2023-06-23 20:46:27 +02:00
TimeAgoTests.swift Fix localization issues, add tests, import translations, and add zh-CN and zh-TW 2023-02-24 12:44:54 -08:00
TrieTests.swift Add trie-based user search cache to replace non-performant linear scans 2023-07-03 12:06:01 -07:00
UrlTests.swift test: attempt to fix broken tests 2023-11-13 15:03:17 -08:00
UserSearchAppendTests.swift posting: fix issue with username and multiple emojis 2023-09-11 07:48:36 -07:00
UserSearchCacheTests.swift test: temporarily disable UserCacheManagerTests 2023-10-07 14:35:24 -07:00
WalletConnectTests.swift nostrdb: add profiles to nostrdb 2023-09-21 09:10:06 -04:00
ZapTests.swift test: temporarily disable UserCacheManagerTests 2023-10-07 14:35:24 -07:00