CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
telemetry-utils.test.ts47 linesDownload Raw Back to telemetry
1/**2 * @license3 * Copyright 2025 Google LLC4 * SPDX-License-Identifier: Apache-2.05 */6 7import { describe, it, expect } from 'vitest';8import { getProgrammingLanguage } from './telemetry-utils.js';9 10describe('getProgrammingLanguage', () => {11  it('should return TypeScript for .ts files', () => {12    const args = { file_path: 'src/test.ts' };13    const language = getProgrammingLanguage(args);14    expect(language).toBe('TypeScript');15  });16 17  it('should return Python for .py files', () => {18    const args = { file_path: 'src/test.py' };19    const language = getProgrammingLanguage(args);20    expect(language).toBe('Python');21  });22 23  it('should return the programming language when path is present', () => {24    const args = { path: 'src/test.go' };25    const language = getProgrammingLanguage(args);26    expect(language).toBe('Go');27  });28 29  it('should return undefined when no file path is present', () => {30    const args = {};31    const language = getProgrammingLanguage(args);32    expect(language).toBeUndefined();33  });34 35  it('should handle unknown file extensions gracefully', () => {36    const args = { file_path: 'src/test.unknown' };37    const language = getProgrammingLanguage(args);38    expect(language).toBeUndefined();39  });40 41  it('should handle files with no extension', () => {42    const args = { file_path: 'src/test' };43    const language = getProgrammingLanguage(args);44    expect(language).toBeUndefined();45  });46});47 
basant307/AI_Governance_Project · CoolFace