testPrintTemplate.ts 615 Bytes
import testTemplateJson from './test.json'
import { adaptSystemLabelTemplate } from '../systemTemplateAdapter'
import type { LabelTemplateData, StructuredLabelTemplate, SystemLabelTemplate } from '../types/printer'

export const TEST_PRINT_SYSTEM_TEMPLATE = testTemplateJson as SystemLabelTemplate

export const TEST_PRINT_TEMPLATE_DATA: LabelTemplateData = {}

export function createTestPrintTemplate (
  dpi = 203,
  printQty = 1,
  data: LabelTemplateData = TEST_PRINT_TEMPLATE_DATA
): StructuredLabelTemplate {
  return adaptSystemLabelTemplate(TEST_PRINT_SYSTEM_TEMPLATE, data, {
    dpi,
    printQty,
  })
}