|
| 1 | +import { mount } from "@vue/test-utils"; |
| 2 | +import { describe, expect, it } from "vitest"; |
| 3 | +import { createI18n } from "vue-i18n"; |
| 4 | +import SubscriptionPlanCard from "../SubscriptionPlanCard.vue"; |
| 5 | + |
| 6 | +const i18n = createI18n({ |
| 7 | + legacy: false, |
| 8 | + locale: "en", |
| 9 | + fallbackWarn: false, |
| 10 | + missingWarn: false, |
| 11 | + messages: { |
| 12 | + en: { |
| 13 | + payment: { |
| 14 | + days: "days", |
| 15 | + models: "Models", |
| 16 | + planCard: { |
| 17 | + quota: "Quota", |
| 18 | + rate: "Rate", |
| 19 | + unlimited: "Unlimited", |
| 20 | + }, |
| 21 | + subscribeNow: "Subscribe now", |
| 22 | + }, |
| 23 | + }, |
| 24 | + }, |
| 25 | +}); |
| 26 | + |
| 27 | +const mountPlanCard = (groupPlatform: string) => |
| 28 | + mount(SubscriptionPlanCard, { |
| 29 | + props: { |
| 30 | + plan: { |
| 31 | + id: 1, |
| 32 | + group_id: 10, |
| 33 | + group_platform: groupPlatform, |
| 34 | + name: "Pro", |
| 35 | + price: 10, |
| 36 | + amount: 1000, |
| 37 | + features: [], |
| 38 | + rate_multiplier: 1, |
| 39 | + validity_days: 30, |
| 40 | + validity_unit: "day", |
| 41 | + supported_model_scopes: ["claude", "gemini_text", "gemini_image"], |
| 42 | + is_active: true, |
| 43 | + }, |
| 44 | + }, |
| 45 | + global: { plugins: [i18n] }, |
| 46 | + }); |
| 47 | + |
| 48 | +describe("SubscriptionPlanCard", () => { |
| 49 | + it("does not show Antigravity model scopes for OpenAI plans", () => { |
| 50 | + const text = mountPlanCard("openai").text(); |
| 51 | + |
| 52 | + expect(text).not.toContain("Claude"); |
| 53 | + expect(text).not.toContain("Gemini"); |
| 54 | + expect(text).not.toContain("Imagen"); |
| 55 | + }); |
| 56 | + |
| 57 | + it("shows model scopes for Antigravity plans", () => { |
| 58 | + const text = mountPlanCard("antigravity").text(); |
| 59 | + |
| 60 | + expect(text).toContain("Claude"); |
| 61 | + expect(text).toContain("Gemini"); |
| 62 | + expect(text).toContain("Imagen"); |
| 63 | + }); |
| 64 | +}); |
0 commit comments