UNPKG

shipmast

Version:

Automated License & Metadata applicators for Codebases.

21 lines (18 loc) 836 B
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { applyTemplate, applyTemplateGlob, removeGlob } from '../src/index.js'; import fs from 'fs/promises'; import { glob } from 'glob'; import { describe, it, expect } from 'vitest'; import { applyTemplate } from '../src/index.js'; describe('applyTemplate', () => { it('should modify content correctly', async () => { const content = '/*˹ Old License Block ˼*/\nconsole.log("Hello");'; const template = '/*˹ New License Block {{version}} ˼*/'; const result = await applyTemplate(content, template, { data: { pre: { version: '1.0.0' }, post: {} }, }); expect(result.updated).toBe(true); expect(result.result).toContain('/*˹ New License Block'); expect(result.result).toContain('1.0.0'); }); });