Downloading the github Project for this course

This guide will help you clone, install, and test the sample project for Azure Durable Functions in JavaScript.
GitHub repo: learn-automated-testing/Azure_dureable_functions_javascript_example

1. Clone the Repository

First, clone the repository from GitHub:

git clone https://github.com/learn-automated-testing/Azure_dureable_functions_javascript_example.git
cd Azure_dureable_functions_javascript_example

2. Install Dependencies

Before you can run or test the project, install the required Node.js packages. Make sure you have Node.js and npm installed.

npm install

3. Understanding package.json

The package.json file is the metadata and manifest for your Node.js project. It defines:

{
  "name": "azure_dureable_functions_javascript_example",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "start": "func start",
    "test": "jest",
    "test:watch": "jest --watch"
  },
  "dependencies": {
    "@azure/functions": "^4.0.0",
    "@azure/storage-blob": "^12.27.0",
    "durable-functions": "^3.0.0-alpha.5",
    "events": "^3.3.0",
    "pdfkit": "^0.17.1"
  },
  "devDependencies": {
    "@types/jest": "^29.5.12",
    "axios": "^1.9.0",
    "jest": "^29.7.0"
  },
  "jest": {
    "testEnvironment": "node",
    "testMatch": [
      "**/__tests__/**/*.test.js"
    ],
    "collectCoverage": true,
    "coverageDirectory": "coverage",
    "coverageReporters": [
      "text",
      "lcov"
    ],
    "verbose": true
  },
  "main": "src/{index.js,functions/*.js}"
}
  1. Checking if the function app starts
npm start
func start

Testing the Functions

Trigger functions locally: Use tools like Postman, curl, or your browser to send requests to your local HTTP endpoints (usually http://localhost:7071).

Check logs and output: The console will display logs from your orchestrator, activity, and client functions.

Automated tests: the automated test can be run via the jest package, there is a unit test testing modular functionalities and one which is testing the integration.