mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-06 21:50:05 +00:00
don't use compound name, use isSubscriptionRequirementMet
This commit is contained in:
@@ -7,7 +7,7 @@ import SubscriptionPanel from '@/platform/cloud/subscription/components/Subscrip
|
||||
|
||||
// Mock composables
|
||||
const mockSubscriptionData = {
|
||||
isSubscribedOrIsNotCloud: false,
|
||||
isSubscriptionRequirementMet: false,
|
||||
isCancelled: false,
|
||||
formattedRenewalDate: '2024-12-31',
|
||||
formattedEndDate: '2024-12-31',
|
||||
@@ -120,14 +120,14 @@ describe('SubscriptionPanel', () => {
|
||||
|
||||
describe('subscription state functionality', () => {
|
||||
it('shows correct UI for active subscription', () => {
|
||||
mockSubscriptionData.isSubscribedOrIsNotCloud = true
|
||||
mockSubscriptionData.isSubscriptionRequirementMet = true
|
||||
const wrapper = createWrapper()
|
||||
expect(wrapper.text()).toContain('Manage Subscription')
|
||||
expect(wrapper.text()).toContain('Add Credits')
|
||||
})
|
||||
|
||||
it('shows correct UI for inactive subscription', () => {
|
||||
mockSubscriptionData.isSubscribedOrIsNotCloud = false
|
||||
mockSubscriptionData.isSubscriptionRequirementMet = false
|
||||
const wrapper = createWrapper()
|
||||
expect(wrapper.findComponent({ name: 'SubscribeButton' }).exists()).toBe(
|
||||
true
|
||||
@@ -137,14 +137,14 @@ describe('SubscriptionPanel', () => {
|
||||
})
|
||||
|
||||
it('shows renewal date for active non-cancelled subscription', () => {
|
||||
mockSubscriptionData.isSubscribedOrIsNotCloud = true
|
||||
mockSubscriptionData.isSubscriptionRequirementMet = true
|
||||
mockSubscriptionData.isCancelled = false
|
||||
const wrapper = createWrapper()
|
||||
expect(wrapper.text()).toContain('Renews 2024-12-31')
|
||||
})
|
||||
|
||||
it('shows expiry date for cancelled subscription', () => {
|
||||
mockSubscriptionData.isSubscribedOrIsNotCloud = true
|
||||
mockSubscriptionData.isSubscriptionRequirementMet = true
|
||||
mockSubscriptionData.isCancelled = true
|
||||
const wrapper = createWrapper()
|
||||
expect(wrapper.text()).toContain('Expires 2024-12-31')
|
||||
|
||||
@@ -92,7 +92,7 @@ describe('useSubscription', () => {
|
||||
})
|
||||
|
||||
describe('computed properties', () => {
|
||||
it('should compute isSubscribedOrIsNotCloud correctly when subscription is active', async () => {
|
||||
it('should compute isSubscriptionRequirementMet correctly when subscription is active', async () => {
|
||||
vi.mocked(global.fetch).mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -103,13 +103,13 @@ describe('useSubscription', () => {
|
||||
} as Response)
|
||||
|
||||
mockIsLoggedIn.value = true
|
||||
const { isSubscribedOrIsNotCloud, fetchStatus } = useSubscription()
|
||||
const { isSubscriptionRequirementMet, fetchStatus } = useSubscription()
|
||||
|
||||
await fetchStatus()
|
||||
expect(isSubscribedOrIsNotCloud.value).toBe(true)
|
||||
expect(isSubscriptionRequirementMet.value).toBe(true)
|
||||
})
|
||||
|
||||
it('should compute isSubscribedOrIsNotCloud as false when subscription is inactive', async () => {
|
||||
it('should compute isSubscriptionRequirementMet as false when subscription is inactive', async () => {
|
||||
vi.mocked(global.fetch).mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -120,10 +120,10 @@ describe('useSubscription', () => {
|
||||
} as Response)
|
||||
|
||||
mockIsLoggedIn.value = true
|
||||
const { isSubscribedOrIsNotCloud, fetchStatus } = useSubscription()
|
||||
const { isSubscriptionRequirementMet, fetchStatus } = useSubscription()
|
||||
|
||||
await fetchStatus()
|
||||
expect(isSubscribedOrIsNotCloud.value).toBe(false)
|
||||
expect(isSubscriptionRequirementMet.value).toBe(false)
|
||||
})
|
||||
|
||||
it('should format renewal date correctly', async () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('useSubscriptionCancellationWatcher', () => {
|
||||
baseStatus
|
||||
)
|
||||
const isActive = ref(true)
|
||||
const isSubscribedOrIsNotCloud = computed(() => isActive.value)
|
||||
const isSubscriptionRequirementMet = computed(() => isActive.value)
|
||||
|
||||
let shouldWatch = true
|
||||
const shouldWatchCancellation = () => shouldWatch
|
||||
@@ -76,7 +76,7 @@ describe('useSubscriptionCancellationWatcher', () => {
|
||||
|
||||
const { startCancellationWatcher } = initWatcher({
|
||||
fetchStatus,
|
||||
isSubscribedOrIsNotCloud,
|
||||
isSubscriptionRequirementMet,
|
||||
subscriptionStatus,
|
||||
telemetry: telemetryMock,
|
||||
shouldWatchCancellation
|
||||
@@ -106,7 +106,7 @@ describe('useSubscriptionCancellationWatcher', () => {
|
||||
|
||||
const { startCancellationWatcher } = initWatcher({
|
||||
fetchStatus,
|
||||
isSubscribedOrIsNotCloud,
|
||||
isSubscriptionRequirementMet,
|
||||
subscriptionStatus,
|
||||
telemetry: telemetryMock,
|
||||
shouldWatchCancellation
|
||||
@@ -128,7 +128,7 @@ describe('useSubscriptionCancellationWatcher', () => {
|
||||
|
||||
const { startCancellationWatcher } = initWatcher({
|
||||
fetchStatus,
|
||||
isSubscribedOrIsNotCloud,
|
||||
isSubscriptionRequirementMet,
|
||||
subscriptionStatus,
|
||||
telemetry: telemetryMock,
|
||||
shouldWatchCancellation
|
||||
@@ -153,7 +153,7 @@ describe('useSubscriptionCancellationWatcher', () => {
|
||||
|
||||
const { startCancellationWatcher } = initWatcher({
|
||||
fetchStatus,
|
||||
isSubscribedOrIsNotCloud,
|
||||
isSubscriptionRequirementMet,
|
||||
subscriptionStatus,
|
||||
telemetry: telemetryMock,
|
||||
shouldWatchCancellation
|
||||
|
||||
Reference in New Issue
Block a user