import { describe, it, expect, vi } from 'vitest'
import { toXML } from '../server/utils/xml'
import { responseSchema, commentAnalysisSchema } from '../server/utils/schema'
import { getLoggerProxy } from '../server/utils/proxy'
describe('toXML', () => {
it('should convert the comment analysis schema to XML', () => {
const xml = toXML(commentAnalysisSchema)
expect(xml).toMatchInlineSnapshot(`"Issue CategorisationobjectbooleanbooleanIf the issue reported is a bug and the bug has reappeared on upgrade to a new version of Nuxt, it is a possible regression."`)
})
it('should convert the response analysis schema to XML', () => {
const xml = toXML(responseSchema)
expect(xml).toMatchInlineSnapshot(`"Issue Categorisationobjectstring<0>bug0><1>feature1><2>documentation2><3>chore3><4>help-wanted4><5>spam5>booleanstringThe language of the title in ISO 639-1 format. Do not include country codes, only language code.booleanIf the issue is reported on upgrade to a new version of Nuxt, it is a possible regression.booleanIf the issue is reported only in relation to a single deployment provider, it is possibly a Nitro issue."`)
})
})
describe('getLoggerProxy', () => {
it('should not error when called with GitHub rest api methods', () => {
vi.spyOn(console, 'log').mockImplementation(() => {})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const github = getLoggerProxy()
github.issues.removeLabel({})
github.issues.update({})
github.issues.addLabels({})
github.issues.removeLabel({})
github.graphql(``)
expect(console.log).toHaveBeenCalledTimes(5)
})
})