mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
code: tsx,nextjs,frontends (2 files)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import type { CodegenManifest } from '@/lib/codegen/codegen-types'
|
||||
import { useMemo, useState, type ChangeEvent } from 'react'
|
||||
|
||||
import {
|
||||
@@ -63,7 +64,11 @@ const fetchZip = async (values: FormState) => {
|
||||
const blob = await response.blob()
|
||||
const filename = createFilename(response.headers.get('content-disposition'), `${values.projectName}.zip`)
|
||||
downloadBlob(blob, filename)
|
||||
return filename
|
||||
const manifestHeader = response.headers.get('x-codegen-manifest')
|
||||
const manifest = manifestHeader
|
||||
? (JSON.parse(decodeURIComponent(manifestHeader)) as CodegenManifest)
|
||||
: null
|
||||
return { filename, manifest }
|
||||
}
|
||||
|
||||
export default function CodegenStudioClient() {
|
||||
@@ -71,6 +76,7 @@ export default function CodegenStudioClient() {
|
||||
const [status, setStatus] = useState<FetchStatus>('idle')
|
||||
const [message, setMessage] = useState<string | null>(null)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [manifest, setManifest] = useState<CodegenManifest | null>(null)
|
||||
|
||||
const runtimeDescription = useMemo(() => {
|
||||
switch (form.runtime) {
|
||||
|
||||
@@ -64,9 +64,9 @@ describe('PowerTransferTab', () => {
|
||||
renderComponent()
|
||||
|
||||
await waitFor(() => expect(fetchMock).toHaveBeenCalled())
|
||||
expect(await screen.findByText(/Recent transfers/i)).toBeInTheDocument()
|
||||
expect(screen.getByText(/Transfer to target-god/i)).toBeInTheDocument()
|
||||
expect(screen.getByText(/Requested by supergod/i)).toBeInTheDocument()
|
||||
await screen.findByText(/Recent transfers/i)
|
||||
expect(screen.getByText(/Transfer to target-god/i)).toBeDefined()
|
||||
expect(screen.getByText(/Requested by supergod/i)).toBeDefined()
|
||||
})
|
||||
|
||||
it('fires onInitiateTransfer when a user card is clicked', async () => {
|
||||
|
||||
Reference in New Issue
Block a user