-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core Data: Replace unnecessary fetch requests for upserting orders and order search results #14128
base: trunk
Are you sure you want to change the base?
Changes from 6 commits
76c74fc
a6b1301
95bdd30
8eca7f0
bfe7a8f
a716f47
a27533c
f368915
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,30 @@ final class StorageTypeExtensionsTests: XCTestCase { | |
XCTAssertEqual(site, storedSite) | ||
} | ||
|
||
func test_loadOrders_list_by_siteID_and_orderIDs() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: We could update this test by adding an order with a different site ID other than There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the test in a27533c. |
||
// Given | ||
let orderID1: Int64 = 123 | ||
let order1 = storage.insertNewObject(ofType: Order.self) | ||
order1.siteID = sampleSiteID | ||
order1.orderID = orderID1 | ||
|
||
let orderID2: Int64 = 125 | ||
let order2 = storage.insertNewObject(ofType: Order.self) | ||
order2.siteID = sampleSiteID | ||
order2.orderID = orderID2 | ||
|
||
let orderID3: Int64 = 126 | ||
let order3 = storage.insertNewObject(ofType: Order.self) | ||
order3.siteID = sampleSiteID | ||
order3.orderID = orderID3 | ||
|
||
// When | ||
let storedOrders = storage.loadOrders(siteID: sampleSiteID, orderIDs: [orderID1, orderID3]) | ||
|
||
// Then | ||
XCTAssertEqual(storedOrders, [order3, order1]) | ||
} | ||
|
||
func test_loadOrder_by_siteID_and_orderID() throws { | ||
// Given | ||
let orderID: Int64 = 123 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add the
siteID
to the predicate? With the current predicate, I am afraid that we will end up loading orders from other sites with the same order ID.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I updated the predicate in a27533c.