Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 3.14 KB

File metadata and controls

59 lines (40 loc) · 3.14 KB
name testing
description Use for xUnit tests, JSON fixtures, mocks, Coverlet coverage, and scripts in Contentstack.Utils.Tests.

Testing – Contentstack Utils .NET

When to use

  • Adding or changing behavior in Contentstack.Utils and needing unit tests.
  • Debugging CI test failures on Windows (unit-test workflow).
  • Generating local HTML coverage reports.

Instructions

Test project

  • Contentstack.Utils.Tests.csproj: targets net7.0, IsPackable false, references the main library project.
  • Packages: xunit, xunit.runner.visualstudio, Microsoft.NET.Test.Sdk, coverlet.collector, Newtonsoft.Json (aligned with test needs).

Test classes (inventory)

Use these as a map of coverage areas when adding related behavior:

Class Focus
JsonToHtmlTest JSON RTE → HTML
GQLTest Utils.GQL / GraphQL-shaped RTE
UtilsTest Core Utils APIs
UtilsArrayStringTest Array/string rendering paths
UtilsCustomRenderTest Custom Options / rendering
DefaultRenderTest Default render behavior
HtmlDocumentExtensionTest HTML document extensions
MetadataTest Embedded metadata
VariantAliasesTest Variant aliases / metadata tags

Fixtures and content

Constants, helpers, mocks

Quick local test

  • From repo root: dotnet test Contentstack.Utils.sln — runs all tests without the shell scripts (no TRX or coverage collection).

Coverage

CI alignment

  • GitHub Actions runs Scripts/run-unit-test-case.sh on Windows. When reproducing CI failures, use that script (or the same dotnet test arguments) from repo root.