Skip to content

Commit 350d647

Browse files
committed
Transform value to corresponding dropdown item's key #758
1 parent ecb71c3 commit 350d647

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/app/import/services/subscription-details/import-upload-subscription-details.service.spec.ts

+19
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,25 @@ describe("ImportUploadSubscriptionDetailsService", () => {
117117
total: 3,
118118
});
119119
});
120+
121+
it("sends `Key` of corresponding dropdown item as value", async () => {
122+
const entry = buildEntry(
123+
{ eventId: 11, subscriptionDetailId: 1001, value: "Apple" },
124+
{ validationStatus: "valid", importStatus: null },
125+
);
126+
entry.data.subscriptionDetail!.DropdownItems = [
127+
{ Key: 10, Value: "Apple", IsActive: true },
128+
{ Key: 11, Value: "Pear", IsActive: true },
129+
];
130+
131+
await service.upload([entry]);
132+
133+
expect(subscriptionDetailsServiceMock.update).toHaveBeenCalledTimes(1);
134+
135+
const value =
136+
subscriptionDetailsServiceMock.update.calls.mostRecent().args[1];
137+
expect(value).toBe(10);
138+
});
120139
});
121140

122141
function buildEntry(

0 commit comments

Comments
 (0)