Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

703 B
Raw Blame
/// <reference types="vitest/globals" />

import { changeFileEncoding } from '../src/lib/actions/change-file-encoding';
import { createMockActionContext, ApFile } from '@activepieces/pieces-framework';

describe('changeFileEncoding', () => {
  test('changes encoding from utf8 to base64', async () => {
    const file = new ApFile('input.txt', Buffer.from('Hello, World!', 'utf8'), 'txt');
    const ctx = createMockActionContext({
      propsValue: {
        inputFile: file,
        inputEncoding: 'utf8',
        outputFileName: 'output.txt',
        outputEncoding: 'base64',
      },
    });
    const result = await changeFileEncoding.run(ctx);
    expect(result).toBe('test-file-url');
  });
});