UNPKG

ondc-campaign-sdk

Version:

[![npm version](https://img.shields.io/npm/v/ondc-campaign-sdk.svg)](https://www.npmjs.com/package/ondc-campaign-sdk) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Made with ❤️](https://img.shields.io/badge/Made%20with-%

29 lines (24 loc) 941 B
const { fetchLiveCampaignProducts } = require("./api"); const { renderCampaignsByCount } = require("./templates"); const fs = require("fs"); const path = require("path"); async function test() { const data = await fetchLiveCampaignProducts(); console.log("Campaign Products:", data); } async function testCampaignsByCount() { try { const outputPath = path.join(__dirname, "../test-output"); if (!fs.existsSync(outputPath)) { fs.mkdirSync(outputPath, { recursive: true }); } // Test 1: Get all campaigns console.log("Testing campaigns by count - All campaigns"); const allCampaignsHtml = await renderCampaignsByCount(""); fs.writeFileSync(path.join(outputPath, "campaigns-all.html"), allCampaignsHtml); console.log("All campaigns rendered to: test-output/campaigns-all.html"); } catch (error) { console.error("Error testing campaigns by count:", error); } } testCampaignsByCount();