diff --git a/packages/workbuddy/README.md b/packages/workbuddy/README.md index c31cfc0..75ad950 100644 --- a/packages/workbuddy/README.md +++ b/packages/workbuddy/README.md @@ -370,12 +370,15 @@ kind WorkBuddy's own usage panel lists: the plan's bonus, top-ups (bought credit packs) and platform rewards (gifted and activity credits, 赠送积分). The summary's CreditGroups say which is which (plan_base against plan_bonus, addon and benefit); a summary without them is split -by package code as WorkBuddy's client does. Only one of the two stops the -account, since WorkBuddy serves it while any credits are left: the extra -window is set aside until the plan's credits are spent, then the plan's -is. Extra credits only the detail lists carry (a China-site free +by package code as WorkBuddy's client does. Neither stops the account, +since WorkBuddy serves it while any credits are left: both are set aside, +and a third window, "Total credits", the two together, stops it. It has +the plan's cycle and the soonest lapse of the two, so every account reads +the same, its plan's credits spent or not (ferock on Discord; before +0.2.24 the extra window stood in for the account only once the plan's +were spent). Extra credits only the detail lists carry (a China-site free account's summary can list the plan's base alone) are their own "Extra -credits" window by the same rule (ferock on Discord). A summary with +credits" window, with a "Total credits" by the same rule. A summary with only one kind keeps the one "Credits" window (akic404 on Discord; since 0.2.16 the plan's bonus is extra too, Jiabubu on Discord). diff --git a/packages/workbuddy/index.mjs b/packages/workbuddy/index.mjs index 7c6c664..88e0045 100644 --- a/packages/workbuddy/index.mjs +++ b/packages/workbuddy/index.mjs @@ -2912,18 +2912,20 @@ function pinning() { // the client's resolveCreditGroup does (PLAN_CODES, see planCodes). A // summary with only one kind keeps the one "Credits" window, as before. // -// Only one of the two stops the account at a time: WorkBuddy serves it -// while any credits are left, so the one set aside is the one whose -// running out doesn't stop it — "Extra credits", until the plan's are -// spent and extra ones are left. +// Neither of the two stops the account: WorkBuddy serves it while any +// credits are left, of either kind. Both are set aside, and the account's +// whole is a third window, "Total credits", which stops it (totalOf). +// Before, the one that stopped it was the plan's until its credits were +// spent and the extra one's after, so magpie's Routing page said the +// plan's "500 / 500" alone on one account and the extra credits on +// another, and an account at 90% of its plan's credits was kept for last +// with its extra ones untouched (ferock on Discord, 0.2.22). function usageOf(sum, plan, site) { const out = { plan: plan || (sum?.IsPaidUser ? "Pro" : "Free plan"), windows: [] } const { plan: mine, extra, left, bags } = kindsOf(sum, site) if (mine.total > 0 && extra.total > 0) { const credits = creditWindow("Credits", mine), more = creditWindow("Extra credits", extra) - if (mine.used >= mine.total && extra.used < extra.total) credits.aside = true - else more.aside = true - out.windows.push(credits, more) + out.windows.push(credits, more, totalOf(credits, more)) } else { const total = mine.total + extra.total, used = mine.used + extra.used if (total > 0) out.windows.push(creditWindow("Credits", { used, total })) @@ -2936,6 +2938,23 @@ function usageOf(sum, plan, site) { // creditWindow is a window of credits used of a total. const creditWindow = (name, { used, total }) => ({ name, used: (100 * used) / total, display: `${compact(used)} / ${compact(total)}`, amount: used, limit: total, unit: "credits" }) +// totalOf is the account's whole credits, the plan's and the extra ones, +// as the window that stops it, and sets the two aside (see usageOf). It +// renews with the plan's (its cycle, resetsAt and span), and says the +// soonest of the two to lapse (runsOutAt, runsOut), as routing reads no +// window set aside. +function totalOf(plan, extra) { + plan.aside = extra.aside = true + const w = creditWindow("Total credits", { used: plan.amount + extra.amount, total: plan.limit + extra.limit }) + if (plan.resetsAt) w.resetsAt = plan.resetsAt + if (plan.span) w.span = plan.span + const at = (x) => (x.runsOutAt ? Date.parse(x.runsOutAt) : 0) + const [a, b] = [at(plan), at(extra)] + const soon = a > 0 && (!(b > 0) || a <= b) ? plan : b > 0 ? extra : null + if (soon) Object.assign(w, { runsOutAt: soon.runsOutAt, runsOut: soon.runsOut + (a > 0 && a === b ? extra.runsOut : 0) }) + return w +} + // kindsOf is the summary's credits, the plan's and the extra ones (see // usageOf), and what is left in its packages with no total (a prepaid // balance). @@ -3985,35 +4004,26 @@ function makePlugin(site) { const packages = await packagesOf(site, a) Object.assign(credits, cycleOf(sum, packages) ?? {}) const ofPlan = planCodes(sum, site) - const stops = extra && !extra.aside ? extra : credits - Object.assign(stops, runsOutOf(sum, packages) ?? {}) - const aside = extra ? (stops === credits ? extra : credits) : null - if (aside) Object.assign(aside, runsOutOf(sum, packages, Date.now(), (code) => ofPlan(code) === (aside === credits)) ?? {}) - // the summary of the plan's credits alone: the extra ones - // only the detail lists have (listedExtra) are their window. - // As with the summary's split (usageOf), one of the two stops - // the account: the plan's, until its credits are spent with - // extra ones left. WorkBuddy goes on serving such an account on - // its extra credits (ferock on Discord, a China-site account - // at "500 / 500" moved off while its extra ones were left). - const kinds = !extra && kindsOf(sum, site) - const more = kinds && kinds.plan.total > 0 && kinds.extra.total === 0 ? listedExtra(sum, packages, site) : null - if (more) { - const { runsOutAt, runsOut, ...counts } = more - const w = { ...creditWindow("Extra credits", counts), ...(runsOutAt ? { runsOutAt, runsOut } : {}) } - const planSpent = credits.amount >= credits.limit && counts.used < counts.total - if (planSpent) credits.aside = true - else w.aside = true - out.windows.splice(out.windows.indexOf(credits) + 1, 0, w) - // and, as with the split's, the soonest credits to lapse are - // the account's too, on the window that stops it: routing - // reads none set aside, so an account whose extra credits - // expire first went unknown to it (Kayphoon on Discord) - const [stops, other] = planSpent ? [w, credits] : [credits, w] - const at = other.runsOutAt ? Date.parse(other.runsOutAt) : 0 - const was = stops.runsOutAt ? Date.parse(stops.runsOutAt) : 0 - if (at > 0 && (!was || at < was)) Object.assign(stops, { runsOutAt: other.runsOutAt, runsOut: other.runsOut }) - else if (at > 0 && at === was) stops.runsOut = (stops.runsOut ?? 0) + other.runsOut + if (extra) { + // split by the summary (usageOf): each says its own + // packages' soonest lapse, the whole the soonest of both + Object.assign(credits, runsOutOf(sum, packages, Date.now(), ofPlan) ?? {}) + Object.assign(extra, runsOutOf(sum, packages, Date.now(), (code) => !ofPlan(code)) ?? {}) + out.windows.splice(out.windows.findIndex((w) => w.name === "Total credits"), 1, totalOf(credits, extra)) + } else { + Object.assign(credits, runsOutOf(sum, packages) ?? {}) + // the summary of the plan's credits alone: the extra ones + // only the detail lists have (listedExtra) are their window, + // and the whole stops the account, as with the summary's + // split (ferock on Discord: WorkBuddy goes on serving an + // account at "500 / 500" on its extra credits) + const kinds = kindsOf(sum, site) + const more = kinds.plan.total > 0 && kinds.extra.total === 0 ? listedExtra(sum, packages, site) : null + if (more) { + const { runsOutAt, runsOut, ...counts } = more + const w = { ...creditWindow("Extra credits", counts), ...(runsOutAt ? { runsOutAt, runsOut } : {}) } + out.windows.splice(out.windows.indexOf(credits) + 1, 0, w, totalOf(credits, w)) + } } } catch {} } diff --git a/packages/workbuddy/package.json b/packages/workbuddy/package.json index 10c5b55..59a680b 100644 --- a/packages/workbuddy/package.json +++ b/packages/workbuddy/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-workbuddy-auth", - "version": "0.2.23", + "version": "0.2.24", "description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)", "type": "module", "main": "./opencode.mjs", diff --git a/packages/workbuddy/usage.test.mjs b/packages/workbuddy/usage.test.mjs index ca1f7a9..7226364 100644 --- a/packages/workbuddy/usage.test.mjs +++ b/packages/workbuddy/usage.test.mjs @@ -313,7 +313,10 @@ test("the credits that run out soonest, for routing to spend first (cdredfox on }) const auth = { type: "oauth", access: "a", refresh: "r", expires: later(), uid: "u" } const u = await usageOf(WorkBuddyAIAuthPlugin, auth) - const w = u.windows.find((x) => x.name === "Credits") + // on the window that stops the account (the whole of a split summary's + // credits), as routing reads no window set aside + const w = u.windows.find((x) => !x.aside) + expect(w.name).toBe("Total credits") expect(w.runsOutAt).toBe("2036-10-12T16:39:27.000Z") expect(w.runsOut).toBe(232.4) // the lists are asked for as WorkBuddy's client asks: without the codes @@ -429,9 +432,10 @@ test("a detail list that can't be read leaves the card as it was", async () => { const u = await usageOf(WorkBuddyAIAuthPlugin, { type: "oauth", access: "a", refresh: "r", expires: later(), uid: "u" }) expect(u.error).toBeUndefined() // the plan's base (Pro) apart from its Plan Bonus and the Bonus Pack, as usageOf says them - expect(u.windows.slice(0, 2)).toEqual([ - { name: "Credits", used: 0, display: "0 / 1000", amount: 0, limit: 1000, unit: "credits" }, + expect(u.windows.slice(0, 3)).toEqual([ + { name: "Credits", used: 0, display: "0 / 1000", amount: 0, limit: 1000, unit: "credits", aside: true }, { name: "Extra credits", used: 100 * 17.6 / 1250, display: "17.6 / 1250", amount: 17.6, limit: 1250, unit: "credits", aside: true }, + { name: "Total credits", used: 100 * 17.6 / 2250, display: "17.6 / 2250", amount: 17.6, limit: 2250, unit: "credits" }, ]) }) @@ -445,24 +449,26 @@ test("the plan's credits and the gifted ones are two windows, the plan's with it // the China build: the activity package (007, 赠送积分) apart from the // month's plan base (008, 套餐基础积分) expect(_internal.usageOf(CN_FREE_SUMMARY, "", SITES.workbuddy).windows).toEqual([ - { name: "Credits", used: 0, display: "0 / 500", amount: 0, limit: 500, unit: "credits" }, + { name: "Credits", used: 0, display: "0 / 500", amount: 0, limit: 500, unit: "credits", aside: true }, { name: "Extra credits", used: (100 * 281.9999965) / 2900, display: "282 / 2900", amount: 281.9999965, limit: 2900, unit: "credits", aside: true }, + { name: "Total credits", used: (100 * 281.9999965) / 3400, display: "282 / 3400", amount: 281.9999965, limit: 3400, unit: "credits" }, ]) // WorkBuddy AI: Pro is the plan's base; its Plan Bonus (037) and the // Bonus Pack (006) are extra, as WorkBuddy's usage panel groups them expect(_internal.usageOf(AI_SUMMARY, "", SITES["workbuddy-ai"]).windows.map((w) => [w.name, w.display, !!w.aside])) - .toEqual([["Credits", "0 / 1000", false], ["Extra credits", "17.6 / 1250", true]]) + .toEqual([["Credits", "0 / 1000", true], ["Extra credits", "17.6 / 1250", true], ["Total credits", "17.6 / 2250", false]]) // a summary of the plan's base alone keeps the one window, as before expect(_internal.usageOf({ ...LIVE_SUMMARY, Packages: LIVE_SUMMARY.Packages.slice(0, 1) }, "", SITES["workbuddy-ai"]).windows.map((w) => w.name)).toEqual(["Credits"]) // and one of packages the client names nothing for (or none at all) too expect(_internal.usageOf(PAID, "", SITES.workbuddy).windows.map((w) => [w.name, w.display])).toEqual([["Credits", "2500 / 10000"]]) // the plan's spent with extra ones left: those keep the account going, so - // it is the plan's window that is set aside, not the extra one + // the whole is what stops it, whichever kind is spent (ferock on Discord) const spent = { ...CN_FREE_SUMMARY, Packages: [CN_FREE_SUMMARY.Packages[0], { ...CN_FREE_SUMMARY.Packages[1], CycleRemainCapacity: "0", CycleUsedCapacity: "500" }] } - expect(_internal.usageOf(spent, "", SITES.workbuddy).windows.map((w) => [w.name, !!w.aside])).toEqual([["Credits", true], ["Extra credits", false]]) - // both spent: the plan's stops it, as the summed window did at 100% + expect(_internal.usageOf(spent, "", SITES.workbuddy).windows.map((w) => [w.name, w.display, !!w.aside])) + .toEqual([["Credits", "500 / 500", true], ["Extra credits", "282 / 2900", true], ["Total credits", "782 / 3400", false]]) + // both spent: the whole stops it at 100%, as the summed window did const all = { ...spent, Packages: [{ ...spent.Packages[0], CycleUsedCapacity: "2900" }, spent.Packages[1]] } - expect(_internal.usageOf(all, "", SITES.workbuddy).windows.map((w) => [w.name, w.used, !!w.aside])).toEqual([["Credits", 100, false], ["Extra credits", 100, true]]) + expect(_internal.usageOf(all, "", SITES.workbuddy).windows.map((w) => [w.name, w.used, !!w.aside])).toEqual([["Credits", 100, true], ["Extra credits", 100, true], ["Total credits", 100, false]]) // the free plan's monthly base (008) is the plan's on the China build only; // WorkBuddy AI's client lists it among the packages that only lapse expect(_internal.planCodes(CN_FREE_SUMMARY, SITES.workbuddy)("TCACA_code_008_cfWoLwvjU4")).toBe(true) @@ -500,14 +506,14 @@ test("extra credits are every kind but the plan's base, as WorkBuddy's own panel const group = (Kind, total, used) => ({ ...GROUPS_SUMMARY.CreditGroups.find((g) => g.Kind === Kind), CycleTotalCapacity: String(total), CycleUsedCapacity: String(used), CycleRemainCapacity: String(total - used) }) const pro = { ...LIVE_SUMMARY, CreditGroups: [group("plan_base", 1000, 89.2), group("plan_bonus", 1000, 0), group("addon", 500, 120), group("benefit", 300, 30)] } expect(_internal.usageOf(pro, "", SITES["workbuddy-ai"]).windows.map((w) => [w.name, w.display, w.limit, !!w.aside])) - .toEqual([["Credits", "89.2 / 1000", 1000, false], ["Extra credits", "150 / 1800", 1800, true]]) + .toEqual([["Credits", "89.2 / 1000", 1000, true], ["Extra credits", "150 / 1800", 1800, true], ["Total credits", "239.2 / 2800", 2800, false]]) // a kind the client doesn't know yet is extra too, never the plan's const odd = { ...pro, CreditGroups: [...pro.CreditGroups, { ...group("addon", 50, 5), Kind: "something_new" }] } expect(_internal.usageOf(odd, "", SITES["workbuddy-ai"]).windows[1].display).toBe("155 / 1850") // without CreditGroups the codes split as the client's panel does: the // plan's bonus (037) is extra, not the plan's expect(_internal.usageOf(LIVE_SUMMARY, "", SITES["workbuddy-ai"]).windows.map((w) => [w.name, w.display, !!w.aside])) - .toEqual([["Credits", "89.2 / 1000", false], ["Extra credits", "0 / 1000", true]]) + .toEqual([["Credits", "89.2 / 1000", true], ["Extra credits", "0 / 1000", true], ["Total credits", "89.2 / 2000", false]]) for (const code of ["TCACA_code_028_NtpWi0jzXs", "TCACA_code_037_WxOD3MpI2o", "TCACA_code_009_0XmEQc2xOf", "TCACA_code_036_lupO5WgNdG", "TCACA_code_038_OhvqZtiPKr", "TCACA_code_007_nzdH5h4Nl0"]) expect(_internal.planCodes({}, SITES.workbuddy)(code)).toBe(false) // buddyOneVip is a plan's base on both builds @@ -527,7 +533,7 @@ test("split, the plan's window keeps its cycle and each says what lapses", async "/billing/meter/get-user-resource-free-packages": () => ok(on(CN_FREE)), }) const u = await usageOf(WorkBuddyAuthPlugin, { type: "oauth", access: "a", refresh: "r", expires: later(), uid: "u" }) - const [credits, extra] = u.windows + const [credits, extra, total] = u.windows expect(credits.name).toBe("Credits") expect(credits.display).toBe("0 / 500") // the plan base's month, so the pace line is the month's @@ -536,10 +542,13 @@ test("split, the plan's window keeps its cycle and each says what lapses", async expect(extra).toMatchObject({ name: "Extra credits", display: "282 / 2900", aside: true, runsOut: 18.4400035 }) expect(extra.resetsAt).toBeUndefined() expect(extra.span).toBeUndefined() - // the window that stops the account carries the account's soonest lapse, - // as routing reads no window set aside (cdredfox on X) - expect(credits.runsOut).toBe(18.4400035) - expect(credits.runsOutAt).toBe(extra.runsOutAt) + // the plan's own credits (the day's slice) lapse at no time of their own + expect(credits.runsOutAt).toBeUndefined() + // the whole stops the account: it renews with the plan's and carries the + // account's soonest lapse, as routing reads no window set aside + // (cdredfox on X) + expect(total).toMatchObject({ name: "Total credits", display: "282 / 3400", resetsAt: credits.resetsAt, span: credits.span, runsOut: 18.4400035, runsOutAt: extra.runsOutAt }) + expect(total.aside).toBeUndefined() }) // jiabubu on Discord (magpie 0.1.2774, workbuddy 0.2.16, a China-site free @@ -564,15 +573,17 @@ test("extra credits only the detail lists have are a window of their own, set as "/billing/meter/get-user-resource-free-packages": () => ok({ TotalCount: 2, Accounts: [on(gift), on(base)] }), }) const u = await usageOf(WorkBuddyAuthPlugin, { type: "oauth", access: "a", refresh: "r", expires: later(), uid: "u" }) - expect(u.windows.slice(0, 2).map((w) => [w.name, w.display, !!w.aside])).toEqual([["Credits", "0 / 500", false], ["Extra credits", "20 / 1300", true]]) + expect(u.windows.slice(0, 3).map((w) => [w.name, w.display, !!w.aside])) + .toEqual([["Credits", "0 / 500", true], ["Extra credits", "20 / 1300", true], ["Total credits", "20 / 1800", false]]) // the soonest to lapse is the activity's, on the window that says them expect(u.windows[1]).toMatchObject({ amount: 20, limit: 1300, runsOut: 280, runsOutAt: new Date(on(gift).DeductionEndTime).toISOString() }) // and the window that stops the account says it too, as routing reads // none set aside: an account whose extra credits lapse first is spent // first (Kayphoon on Discord) - expect(u.windows[0]).toMatchObject({ runsOut: 280, runsOutAt: u.windows[1].runsOutAt }) - // the plan's window keeps its cycle + expect(u.windows[2]).toMatchObject({ runsOut: 280, runsOutAt: u.windows[1].runsOutAt }) + // the plan's window keeps its cycle, and the whole renews with it expect(u.windows[0].resetsAt).toBe("2036-10-31T15:59:59.000Z") + expect(u.windows[2].resetsAt).toBe("2036-10-31T15:59:59.000Z") const now = Date.parse("2026-11-03T00:00:00Z") // past its end, a package is not counted, as the panel leaves it out @@ -591,10 +602,13 @@ test("extra credits only the detail lists have are a window of their own, set as // ferock on Discord (2026-11-05, a China-site account): "额外积分不计算在内, // 基础积分用完 magpie 就切换账号了,其实账号还能用额外积分". The card read // "500 / 500" on the plan's window alone, and that window stopped the -// account while extra credits only the detail lists carry were left. As -// with the summary's split, the plan's window is set aside once it is spent -// with extra credits left, and the extra window stops the account. -test("plan credits spent with extra ones left from the detail lists: the extra window stops the account (ferock on Discord)", async () => { +// account while extra credits only the detail lists carry were left. +// After 0.2.22 the extra window stopped it once the plan's were spent, and +// magpie's Routing page, which says the window that stops an account, read +// "500 / 500" on accounts with their plan's untouched and the extra +// credits on those with it spent. The whole of both stops it now, the same +// on every account, and both kinds are set aside for the card. +test("plan credits and extra ones from the detail lists: the whole stops the account, spent or not (ferock on Discord)", async () => { const year = Date.UTC(2036, 9, 1) - Date.UTC(2026, 9, 1) const on = (p) => ({ ...p, DeductionEndTime: p.DeductionEndTime + year, CycleStartTime: "2036" + p.CycleStartTime.slice(4), CycleEndTime: "2036" + p.CycleEndTime.slice(4) }) const base = { ...CN_FREE.Accounts[1], CycleCapacitySizePrecise: "500", CycleCapacityRemainPrecise: "0", SlicePeriodUsageDetails: [{ SlicePeriodCapacitySizePrecise: "500", SlicePeriodCapacityRemainPrecise: "0" }] } @@ -610,10 +624,11 @@ test("plan credits spent with extra ones left from the detail lists: the extra w const auth = { type: "oauth", access: "a", refresh: "r", expires: later(), uid: "u" } lists([gift, base]) let u = await usageOf(WorkBuddyAuthPlugin, auth) - expect(u.windows.slice(0, 2).map((w) => [w.name, w.display, w.used, !!w.aside])).toEqual([["Credits", "500 / 500", 100, true], ["Extra credits", "20 / 1300", (100 * 20) / 1300, false]]) + expect(u.windows.slice(0, 3).map((w) => [w.name, w.display, w.used, !!w.aside])) + .toEqual([["Credits", "500 / 500", 100, true], ["Extra credits", "20 / 1300", (100 * 20) / 1300, true], ["Total credits", "520 / 1800", (100 * 520) / 1800, false]]) // the window that stops the account says the soonest lapse, as routing // reads none set aside; the plan's keeps its cycle - expect(u.windows[1]).toMatchObject({ runsOut: 280, runsOutAt: new Date(on(gift).DeductionEndTime).toISOString() }) + expect(u.windows[2]).toMatchObject({ runsOut: 280, runsOutAt: new Date(on(gift).DeductionEndTime).toISOString(), resetsAt: "2036-10-31T15:59:59.000Z" }) expect(u.windows[0].resetsAt).toBe("2036-10-31T15:59:59.000Z") // both spent: the plan's stops it again, at 100% serve({ @@ -622,7 +637,17 @@ test("plan credits spent with extra ones left from the detail lists: the extra w "/billing/meter/get-user-resource-free-packages": () => ok({ TotalCount: 2, Accounts: [on({ ...gift, CycleCapacityRemainPrecise: "0" }), on(base)] }), }) u = await usageOf(WorkBuddyAuthPlugin, auth) - expect(u.windows.slice(0, 2).map((w) => [w.name, w.used, !!w.aside])).toEqual([["Credits", 100, false], ["Extra credits", 100, true]]) + expect(u.windows.slice(0, 3).map((w) => [w.name, w.used, !!w.aside])).toEqual([["Credits", 100, true], ["Extra credits", 100, true], ["Total credits", 100, false]]) + // the plan's untouched: the same three, the whole stopping it, so an + // account says its credits the same way whichever kind is being spent + const fresh = { ...base, CycleCapacityRemainPrecise: "500", SlicePeriodUsageDetails: [{ SlicePeriodCapacitySizePrecise: "500", SlicePeriodCapacityRemainPrecise: "500" }] } + serve({ + "/billing/meter/get-user-resource-summary": () => ok({ ...CN_FREE_SUMMARY, Packages: [{ ...plan, CycleRemainCapacity: "500", CycleUsedCapacity: "0" }] }), + "/billing/meter/get-user-resource-paid-packages": () => ok({ TotalCount: 1, Accounts: [on(topup)] }), + "/billing/meter/get-user-resource-free-packages": () => ok({ TotalCount: 2, Accounts: [on(gift), on(fresh)] }), + }) + u = await usageOf(WorkBuddyAuthPlugin, auth) + expect(u.windows.slice(0, 3).map((w) => [w.name, w.display, !!w.aside])).toEqual([["Credits", "0 / 500", true], ["Extra credits", "20 / 1300", true], ["Total credits", "20 / 1800", false]]) }) test("a summary that already splits the credits, or lists with no extra ones, keep the card as it was", async () => {