Private Function Tests

This directory contains unit tests for private (internal) JiraPS functions.

Test Pattern

All tests in this directory follow the converter function pattern for private (internal) JiraPS functions.

When to Use

Use this template for functions that:

Template Location

See .template.ps1 for the standard test structure.

Reference Example

See ConvertTo-JiraAttachment.Unit.Tests.ps1 for a complete, working example.

Test Structure

Converter function tests focus on a single Describe "Behavior" block with four contexts:

1. Object Conversion

Verify that:

2. Property Mapping

Test that:

Use data-driven tests with -TestCases for comprehensive property validation.

3. Type Conversion

Verify special type handling:

4. Pipeline Support

Test that:

Key Characteristics

Converter tests typically:

Sample JSON Data

Keep your JSON fixtures organized:

#region Definitions
$jiraServer = 'http://jiraserver.example.com'

$sampleJson = @"
{
    "id": "123",
    "name": "Test Resource",
    "created": "2025-01-01T00:00:00.000Z",
    "author": {
        "name": "JonDoe",
        "displayName": "Doe, Jon"
    }
}
"@

$script:sampleObject = ConvertFrom-Json -InputObject $sampleJson
#endregion Definitions

Important: Always remove personal/sensitive data from JSON fixtures.

Key Differences from Public Tests

Unlike CRUD tests in Tests/Functions/Public/: