add damus_donation to profile data model and update tests
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="22E261" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21754" systemVersion="22E261" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||||
<entity name="PersistedProfile" representedClassName="PersistedProfile" syncable="YES">
|
<entity name="PersistedProfile" representedClassName="PersistedProfile" syncable="YES">
|
||||||
<attribute name="about" optional="YES" attributeType="String"/>
|
<attribute name="about" optional="YES" attributeType="String"/>
|
||||||
<attribute name="banner" optional="YES" attributeType="String"/>
|
<attribute name="banner" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="damus_donation" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="display_name" optional="YES" attributeType="String"/>
|
<attribute name="display_name" optional="YES" attributeType="String"/>
|
||||||
<attribute name="id" optional="YES" attributeType="String"/>
|
<attribute name="id" optional="YES" attributeType="String"/>
|
||||||
<attribute name="last_update" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
<attribute name="last_update" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ final class PersistedProfile: NSManagedObject {
|
|||||||
@NSManaged var lud06: String?
|
@NSManaged var lud06: String?
|
||||||
@NSManaged var lud16: String?
|
@NSManaged var lud16: String?
|
||||||
@NSManaged var nip05: String?
|
@NSManaged var nip05: String?
|
||||||
|
@NSManaged var damus_donation: Int16
|
||||||
@NSManaged var last_update: Date? // The date that the profile was last updated by the user
|
@NSManaged var last_update: Date? // The date that the profile was last updated by the user
|
||||||
@NSManaged var network_pull_date: Date? // The date we got this profile from a relay (for staleness checking)
|
@NSManaged var network_pull_date: Date? // The date we got this profile from a relay (for staleness checking)
|
||||||
|
|
||||||
@@ -33,5 +34,6 @@ final class PersistedProfile: NSManagedObject {
|
|||||||
lud06 = profile.lud06
|
lud06 = profile.lud06
|
||||||
lud16 = profile.lud16
|
lud16 = profile.lud16
|
||||||
nip05 = profile.nip05
|
nip05 = profile.nip05
|
||||||
|
damus_donation = profile.damus_donation != nil ? Int16(profile.damus_donation!) : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class Profile: Codable {
|
|||||||
website: persisted_profile.website,
|
website: persisted_profile.website,
|
||||||
lud06: persisted_profile.lud06,
|
lud06: persisted_profile.lud06,
|
||||||
lud16: persisted_profile.lud16,
|
lud16: persisted_profile.lud16,
|
||||||
nip05: persisted_profile.nip05)
|
nip05: persisted_profile.nip05,
|
||||||
|
damus_donation: Int(persisted_profile.damus_donation))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func str(_ str: String) -> String? {
|
private func str(_ str: String) -> String? {
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class ProfileDatabaseTests: XCTestCase {
|
|||||||
website: "test-website",
|
website: "test-website",
|
||||||
lud06: "test-lud06",
|
lud06: "test-lud06",
|
||||||
lud16: "test-lud16",
|
lud16: "test-lud16",
|
||||||
nip05: "test-nip05")
|
nip05: "test-nip05",
|
||||||
|
damus_donation: 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testStoreAndRetrieveProfile() async throws {
|
func testStoreAndRetrieveProfile() async throws {
|
||||||
@@ -53,6 +54,7 @@ class ProfileDatabaseTests: XCTestCase {
|
|||||||
XCTAssertEqual(profile.lud06, retrievedProfile.lud06)
|
XCTAssertEqual(profile.lud06, retrievedProfile.lud06)
|
||||||
XCTAssertEqual(profile.lud16, retrievedProfile.lud16)
|
XCTAssertEqual(profile.lud16, retrievedProfile.lud16)
|
||||||
XCTAssertEqual(profile.nip05, retrievedProfile.nip05)
|
XCTAssertEqual(profile.nip05, retrievedProfile.nip05)
|
||||||
|
XCTAssertEqual(profile.damus_donation, retrievedProfile.damus_donation)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRejectOutdatedProfile() async throws {
|
func testRejectOutdatedProfile() async throws {
|
||||||
|
|||||||
Reference in New Issue
Block a user