test: add setting property tests
Some initial UserSettingsStore property tests
This commit is contained in:
@@ -79,7 +79,22 @@ class damusTests: XCTestCase {
|
||||
XCTAssertNotNil(parsed[1].is_url)
|
||||
XCTAssertNotNil(parsed[2].is_text)
|
||||
}
|
||||
|
||||
|
||||
func testStringArrayStorage() {
|
||||
let key = "test_key_string_values"
|
||||
let scoped_key = setting_property_key(key: key)
|
||||
|
||||
let res = setting_set_property_value(scoped_key: scoped_key, old_value: [], new_value: ["a"])
|
||||
XCTAssertEqual(res, ["a"])
|
||||
|
||||
let got = setting_get_property_value(key: key, scoped_key: scoped_key, default_value: [String]())
|
||||
XCTAssertEqual(got, ["a"])
|
||||
|
||||
_ = setting_set_property_value(scoped_key: scoped_key, old_value: got, new_value: ["a", "b", "c"])
|
||||
let got2 = setting_get_property_value(key: key, scoped_key: scoped_key, default_value: [String]())
|
||||
XCTAssertEqual(got2, ["a", "b", "c"])
|
||||
}
|
||||
|
||||
func testParseUrlUpper() {
|
||||
let parsed = parse_note_content(content: "a HTTPS://jb55.COM b", tags: []).blocks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user