diff --git a/src/domain/native/objcSwiftMetadata.test.ts b/src/domain/native/objcSwiftMetadata.test.ts index 2ada77c5d1..27cf49ca4b 100644 --- a/src/domain/native/objcSwiftMetadata.test.ts +++ b/src/domain/native/objcSwiftMetadata.test.ts @@ -91,6 +91,29 @@ describe("symbol-only Objective-C implementation identity", () => { "category", ); }); + + it("orders distinct category identities independently of provider inventory order", () => { + const names = [ + "-[StoreController(Actions) buildTapped:]", + "-[StoreController(OtherActions) buildTapped:]", + ]; + const inspect = (ordered: string[]) => + inspectNativeDispatchMetadata( + ordered.map((name) => ({ address: "0x1000", name })), + ordered.length, + ); + const forward = inspect(names); + const reverse = inspect([...names].reverse()); + expect(reverse).toEqual(forward); + expect( + reverse.objc_dispatch_implementations.map(({ category }) => category), + ).toEqual(["Actions", "OtherActions"]); + expect( + reverse.objc_dispatch_implementations.map(({ evidence }) => + evidence.map(({ description }) => description), + ), + ).toEqual(names.map((name) => [`Provider symbol ${name}`])); + }); }); describe("symbol-only Objective-C implementation addresses", () => { diff --git a/src/domain/native/objcSwiftMetadata.ts b/src/domain/native/objcSwiftMetadata.ts index bd9180ef55..c54ee9c20b 100644 --- a/src/domain/native/objcSwiftMetadata.ts +++ b/src/domain/native/objcSwiftMetadata.ts @@ -646,12 +646,14 @@ export const inspectNativeDispatchMetadata = ( left.selector, left.method_type, left.implementation_address ?? "", + left.category ?? null, ]), compositeKey([ right.class_name, right.selector, right.method_type, right.implementation_address ?? "", + right.category ?? null, ]), ), );