Skip to main content
Glama

Google Cloud MCP Server

by krzko
schema.test.ts1.93 kB
/** * Tests for Spanner schema utilities */ import { describe, it, expect, vi, beforeEach } from 'vitest'; // Import mocks first import '../../../mocks/google-cloud-mocks.js'; describe('Spanner Schema', () => { beforeEach(() => { vi.clearAllMocks(); }); describe('formatSchemaAsMarkdown', () => { it('should format schema correctly', async () => { const { formatSchemaAsMarkdown } = await import('../../../../src/services/spanner/schema.js'); const mockSchema = { tables: [{ name: 'Users', columns: [ { name: 'id', type: 'STRING(36)', nullable: false }, { name: 'email', type: 'STRING(255)', nullable: false }, { name: 'created_at', type: 'TIMESTAMP', nullable: true } ], primaryKey: ['id'] }] }; const formatted = formatSchemaAsMarkdown(mockSchema); expect(formatted).toContain('Database Schema'); expect(formatted).toContain('## Table: Users'); expect(formatted).toContain('id'); expect(formatted).toContain('STRING(36)'); }); it('should handle empty schema', async () => { const { formatSchemaAsMarkdown } = await import('../../../../src/services/spanner/schema.js'); const emptySchema = { tables: [] }; const formatted = formatSchemaAsMarkdown(emptySchema); expect(formatted).toContain('No tables found'); }); }); describe('getSpannerSchema', () => { it('should handle schema retrieval', async () => { const { getSpannerSchema } = await import('../../../../src/services/spanner/schema.js'); // Mock the database calls try { await getSpannerSchema('test-instance', 'test-database'); } catch (error) { // Expected in test environment without real Spanner connection expect(error).toBeInstanceOf(Error); } }); }); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/krzko/google-cloud-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server