diff --git a/tests/authoring/Applicability/ApplicableToComponent.fs b/tests/authoring/Applicability/ApplicableToComponent.fs new file mode 100644 index 000000000..7a8b50357 --- /dev/null +++ b/tests/authoring/Applicability/ApplicableToComponent.fs @@ -0,0 +1,775 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +module ``product availability``.``applicable to component`` + +open Elastic.Documentation.AppliesTo +open Elastic.Markdown.Myst.Directives.AppliesTo +open authoring +open authoring.MarkdownDocumentAssertions +open Swensen.Unquote +open Xunit + +// Test Stack applicability scenarios +type ``stack applicability tests`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: ga 9.0.0 +``` +""" + + [] + let ``parses to AppliesDirective`` () = + let directives = markdown |> converts "index.md" |> parses + test <@ directives.Length = 1 @> + directives |> appliesToDirective (ApplicableTo( + Stack=AppliesCollection.op_Explicit "ga 9.0.0" + )) + + [] + let ``renders GA with version`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + +

+""" + +type ``stack preview future version`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: preview 9.1.0 +``` +""" + + [] + let ``renders preview future version as planned`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + +

+""" + +type ``stack beta current version`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: beta 8.8.0 +``` +""" + + [] + let ``renders beta current version`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + +

+""" + +type ``stack deprecated`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: deprecated 8.7.0 +``` +""" + + [] + let ``renders deprecated`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Deprecation planned + + +

+""" + +type ``stack removed`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: removed 8.6.0 +``` +""" + + [] + let ``renders removed`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Removal planned + + +

+""" + +type ``stack all versions`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: ga +``` +""" + + [] + let ``renders all versions`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + +

+""" + +// Test Serverless applicability scenarios +type ``serverless all projects`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +serverless: ga 9.0.0 +``` +""" + + [] + let ``renders serverless all projects`` () = + markdown |> convertsToHtml """ +

+ + Serverless + + + Planned + + +

+""" + +type ``serverless individual projects`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +serverless: + elasticsearch: ga 9.0.0 + observability: beta 9.1.0 + security: preview 9.2.0 +``` +""" + + [] + let ``renders serverless individual projects`` () = + markdown |> convertsToHtml """ +

+ + Serverless Elasticsearch + + + Planned + + + + Serverless Observability + + + Planned + + + + Serverless Security + + + Planned + + +

+""" + +// Test Deployment applicability scenarios +type ``deployment ece`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +deployment: + ece: ga 9.0.0 +``` +""" + + [] + let ``renders ECE deployment`` () = + markdown |> convertsToHtml """ +

+ + ECE + + + Planned + + +

+""" + +type ``deployment eck`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +deployment: + eck: beta 9.0.0 +``` +""" + + [] + let ``renders ECK deployment`` () = + markdown |> convertsToHtml """ +

+ + ECK + + + Planned + + +

+""" + +type ``deployment ess`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +deployment: + ess: preview 9.0.0 +``` +""" + + [] + let ``renders ECH deployment`` () = + markdown |> convertsToHtml """ +

+ + ECH + + + Planned + + +

+""" + +type ``deployment self managed`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +deployment: + self: ga 9.0.0 +``` +""" + + [] + let ``renders self-managed deployment`` () = + markdown |> convertsToHtml """ +

+ + Self-Managed + + + Planned + + +

+""" + +// Test Product applicability scenarios +type ``apm agents`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +apm_agent_dotnet: ga 9.0.0 +apm_agent_java: beta 9.1.0 +apm_agent_python: preview 9.2.0 +``` +""" + + [] + let ``renders APM agents`` () = + markdown |> convertsToHtml """ +

+ + APM Agent .NET + + + Planned + + + + APM Agent Java + + + Planned + + + + APM Agent Python + + + Planned + + +

+""" + +type ``edot agents`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +edot_dotnet: ga 9.0.0 +edot_java: beta 9.1.0 +edot_python: preview 9.2.0 +``` +""" + + [] + let ``renders EDOT agents`` () = + markdown |> convertsToHtml """ +

+ + EDOT .NET + + + Planned + + + + EDOT Java + + + Planned + + + + EDOT Python + + + Planned + + +

+""" + +// Test complex scenarios with multiple lifecycles +type ``mixed lifecycles with ga planned`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: ga 8.8.0, preview 9.0.0 +``` +""" + + [] + let ``renders GA planned when preview exists alongside GA`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + + + Stack + + + GA planned + + +

+""" + +type ``deprecation planned`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: deprecated 9.1.0 +``` +""" + + [] + let ``renders deprecation planned for future version`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Deprecation planned + + +

+""" + +type ``removal planned`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: removed 9.1.0 +``` +""" + + [] + let ``renders removal planned for future version`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Removal planned + + +

+""" + +// Test edge cases +type ``unavailable lifecycle`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: unavailable +``` +""" + + [] + let ``renders unavailable`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Unavailable + + + +""" + +type ``product all versions`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +product: ga +``` +""" + + [] + let ``renders product all versions`` () = + markdown |> convertsToHtml """ +

+ + + + + +

+""" + +// Test complex mixed scenarios +type ``complex mixed scenario`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: ga 8.8.0 +serverless: + elasticsearch: beta 9.0.0 + observability: preview 9.1.0 +deployment: + ece: ga 8.8.0 + eck: beta 9.0.0 +apm_agent_dotnet: ga 9.0.0 +apm_agent_java: beta 9.1.0 +``` +""" + + [] + let ``renders complex mixed scenario`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + + + Serverless Elasticsearch + + + Planned + + + + Serverless Observability + + + Planned + + + + ECK + + + Planned + + + + ECE + + + Planned + + + + APM Agent .NET + + + Planned + + + + APM Agent Java + + + Planned + + +

+""" + +// Test missing lifecycle scenarios +type ``lifecycle scenarios missing`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: beta 9.1.0 +deployment: + ece: ga 9.1.0 +``` +""" + + [] + let ``renders missing lifecycle scenarios`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + + + ECE + + + Planned + + +

+""" + +// Test missing version scenarios +type ``version scenarios missing`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: beta 9.1.0 +deployment: + ece: ga 9.1.0 +``` +""" + + [] + let ``renders missing version scenarios`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + + + ECE + + + Planned + + +

+""" + +// Test missing edge cases +type ``edge cases missing`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: +``` +""" + + [] + let ``renders missing edge cases`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + +

+""" + +// Test missing VersioningSystemId coverage +type ``versioning system id coverage`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: ga 9.0.0 +serverless: ga 9.0.0 +deployment: + ece: ga 9.0.0 + eck: ga 9.0.0 + ess: ga 9.0.0 + self: ga 9.0.0 +product: ga 9.0.0 +``` +""" + + [] + let ``renders missing VersioningSystemId coverage`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + + + Serverless + + + Planned + + + + ECH + + + Planned + + + + ECK + + + Planned + + + + ECE + + + Planned + + + + Self-Managed + + + Planned + + + + + + Planned + + +

+""" + +// Test missing disclaimer scenarios +type ``disclaimer scenarios`` () = + static let markdown = Setup.Markdown """ +```{applies_to} +stack: ga 9.0.0 +``` +""" + + [] + let ``renders missing disclaimer scenarios`` () = + markdown |> convertsToHtml """ +

+ + Stack + + + Planned + + +

+""" diff --git a/tests/authoring/Framework/Setup.fs b/tests/authoring/Framework/Setup.fs index cae2c210e..a88e0a499 100644 --- a/tests/authoring/Framework/Setup.fs +++ b/tests/authoring/Framework/Setup.fs @@ -209,6 +209,56 @@ type Setup = Base = SemVersion(8, 0, 0) ) ) + versioningSystems.Add(VersioningSystemId.ApmAgentJava, + VersioningSystem( + Id = VersioningSystemId.ApmAgentJava, + Current = SemVersion(8, 0, 0), + Base = SemVersion(8, 0, 0) + ) + ) + versioningSystems.Add(VersioningSystemId.ApmAgentPython, + VersioningSystem( + Id = VersioningSystemId.ApmAgentPython, + Current = SemVersion(8, 0, 0), + Base = SemVersion(8, 0, 0) + ) + ) + versioningSystems.Add(VersioningSystemId.EdotDotnet, + VersioningSystem( + Id = VersioningSystemId.EdotDotnet, + Current = SemVersion(8, 0, 0), + Base = SemVersion(8, 0, 0) + ) + ) + versioningSystems.Add(VersioningSystemId.EdotJava, + VersioningSystem( + Id = VersioningSystemId.EdotJava, + Current = SemVersion(8, 0, 0), + Base = SemVersion(8, 0, 0) + ) + ) + versioningSystems.Add(VersioningSystemId.EdotPython, + VersioningSystem( + Id = VersioningSystemId.EdotPython, + Current = SemVersion(8, 0, 0), + Base = SemVersion(8, 0, 0) + ) + ) + versioningSystems.Add(VersioningSystemId.Curator, + VersioningSystem( + Id = VersioningSystemId.Curator, + Current = SemVersion(8, 0, 0), + Base = SemVersion(8, 0, 0) + ) + ) + versioningSystems.Add(VersioningSystemId.EdotCollector, + VersioningSystem( + Id = VersioningSystemId.EdotCollector, + Current = SemVersion(8, 0, 0), + Base = SemVersion(8, 0, 0) + ) + ) + let versionConfig = VersionsConfiguration(VersioningSystems = versioningSystems) let configurationFileProvider = ConfigurationFileProvider(fileSystem) let configurationContext = ConfigurationContext( diff --git a/tests/authoring/authoring.fsproj b/tests/authoring/authoring.fsproj index 053238969..661be140d 100644 --- a/tests/authoring/authoring.fsproj +++ b/tests/authoring/authoring.fsproj @@ -51,6 +51,7 @@ +