mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-10 09:01:22 +00:00
Merge pull request #2521 from Brisbanehuang/codex/fix-subscription-model-scopes
fix: hide model scopes for non-antigravity plans
This commit is contained in:
5 files changed
+112
No files matched your search
@@ -147,6 +147,7 @@ const MODEL_SCOPE_LABELS: Record<string, string> = {
|
||||
}
|
||||
|
||||
const modelScopeLabels = computed(() => {
|
||||
if (platform.value !== 'antigravity') return []
|
||||
const scopes = props.plan.supported_model_scopes
|
||||
if (!scopes || scopes.length === 0) return []
|
||||
return scopes.map(s => MODEL_SCOPE_LABELS[s] || s)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createI18n } from "vue-i18n";
|
||||
import SubscriptionPlanCard from "../SubscriptionPlanCard.vue";
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: "en",
|
||||
fallbackWarn: false,
|
||||
missingWarn: false,
|
||||
messages: {
|
||||
en: {
|
||||
payment: {
|
||||
days: "days",
|
||||
models: "Models",
|
||||
planCard: {
|
||||
quota: "Quota",
|
||||
rate: "Rate",
|
||||
unlimited: "Unlimited",
|
||||
},
|
||||
subscribeNow: "Subscribe now",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const mountPlanCard = (groupPlatform: string) =>
|
||||
mount(SubscriptionPlanCard, {
|
||||
props: {
|
||||
plan: {
|
||||
id: 1,
|
||||
group_id: 10,
|
||||
group_platform: groupPlatform,
|
||||
name: "Pro",
|
||||
price: 10,
|
||||
amount: 1000,
|
||||
features: [],
|
||||
rate_multiplier: 1,
|
||||
validity_days: 30,
|
||||
validity_unit: "day",
|
||||
supported_model_scopes: ["claude", "gemini_text", "gemini_image"],
|
||||
is_active: true,
|
||||
},
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
describe("SubscriptionPlanCard", () => {
|
||||
it("does not show Antigravity model scopes for OpenAI plans", () => {
|
||||
const text = mountPlanCard("openai").text();
|
||||
|
||||
expect(text).not.toContain("Claude");
|
||||
expect(text).not.toContain("Gemini");
|
||||
expect(text).not.toContain("Imagen");
|
||||
});
|
||||
|
||||
it("shows model scopes for Antigravity plans", () => {
|
||||
const text = mountPlanCard("antigravity").text();
|
||||
|
||||
expect(text).toContain("Claude");
|
||||
expect(text).toContain("Gemini");
|
||||
expect(text).toContain("Imagen");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user