fix(FN-4554): prefer deviceCode over duplicate instructions
Fusion-Task-Id: FN-4554 Fusion-Task-Lineage: 12d517c5-1954-4b27-8c63-c7f0dde93d3f
This commit is contained in:
@@ -1026,7 +1026,7 @@ export function SettingsModal({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { url, instructions, manualCode, deviceCode } = await loginProvider(providerId);
|
const { url, instructions, manualCode, deviceCode } = await loginProvider(providerId);
|
||||||
if (instructions?.trim()) {
|
if (instructions?.trim() && !(providerId === "github-copilot" && deviceCode)) {
|
||||||
setLoginInstructions((prev) => ({ ...prev, [providerId]: instructions }));
|
setLoginInstructions((prev) => ({ ...prev, [providerId]: instructions }));
|
||||||
}
|
}
|
||||||
if (manualCode) {
|
if (manualCode) {
|
||||||
|
|||||||
@@ -1643,6 +1643,7 @@ describe("SettingsModal", () => {
|
|||||||
});
|
});
|
||||||
mockLoginProvider.mockResolvedValueOnce({
|
mockLoginProvider.mockResolvedValueOnce({
|
||||||
url: "https://auth.example.com/login",
|
url: "https://auth.example.com/login",
|
||||||
|
instructions: "Enter code: ABCD-1234",
|
||||||
deviceCode: {
|
deviceCode: {
|
||||||
userCode: "ABCD-1234",
|
userCode: "ABCD-1234",
|
||||||
verificationUri: "https://github.com/login/device",
|
verificationUri: "https://github.com/login/device",
|
||||||
@@ -1656,6 +1657,7 @@ describe("SettingsModal", () => {
|
|||||||
await userEvent.click(within(copilotCard).getByRole("button", { name: "Login" }));
|
await userEvent.click(within(copilotCard).getByRole("button", { name: "Login" }));
|
||||||
|
|
||||||
expect(await within(copilotCard).findByText("ABCD-1234")).toBeInTheDocument();
|
expect(await within(copilotCard).findByText("ABCD-1234")).toBeInTheDocument();
|
||||||
|
expect(within(copilotCard).queryByTestId("auth-login-instructions-github-copilot")).not.toBeInTheDocument();
|
||||||
await userEvent.click(within(copilotCard).getByRole("button", { name: "Copy code" }));
|
await userEvent.click(within(copilotCard).getByRole("button", { name: "Copy code" }));
|
||||||
expect(writeText).toHaveBeenCalledWith("ABCD-1234");
|
expect(writeText).toHaveBeenCalledWith("ABCD-1234");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user