cintas-workflow.test.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. 'use server';
  2. import { createCintasImportRecord } from './cintas-workflow';
  3. // Test function to verify the workflow step
  4. export async function testCreateCintasImportRecord() {
  5. try {
  6. // Test with mock data
  7. const testFileId = 'test-file-id-123';
  8. const testFileName = 'test-cintas-calendar.xlsx';
  9. const result = await createCintasImportRecord(testFileId, testFileName);
  10. if (result.success && result.data && result.layout) {
  11. console.log('✅ Successfully created Cintas import record:', {
  12. importId: result.data.id,
  13. importName: result.data.name,
  14. layoutName: result.layout.name,
  15. layoutId: result.layout.id
  16. });
  17. return result;
  18. } else {
  19. console.error('❌ Failed to create Cintas import record:', result.error);
  20. return result;
  21. }
  22. } catch (error) {
  23. console.error('❌ Test error:', error);
  24. return {
  25. success: false,
  26. error: error instanceof Error ? error.message : 'Unknown error'
  27. };
  28. }
  29. }
  30. // Export for use in the workflow
  31. export { createCintasImportRecord };