feat: work on completing the lua scripting capabilities
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
29
test/bds/scripting/api_documentation_test.exs
Normal file
29
test/bds/scripting/api_documentation_test.exs
Normal file
@@ -0,0 +1,29 @@
|
||||
defmodule BDS.Scripting.ApiDocumentationTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
test "API.md matches the generated Lua scripting contract" do
|
||||
api_doc_path = Path.expand("../../../API.md", __DIR__)
|
||||
|
||||
assert File.exists?(api_doc_path)
|
||||
assert File.read!(api_doc_path) == BDS.Scripting.ApiDocs.render()
|
||||
end
|
||||
|
||||
test "documented Lua methods match the live capability map" do
|
||||
documented_methods =
|
||||
BDS.Scripting.ApiDocs.render()
|
||||
|> String.split("\n")
|
||||
|> Enum.filter(&String.starts_with?(&1, "### "))
|
||||
|> Enum.map(&String.replace_prefix(&1, "### ", ""))
|
||||
|> Enum.filter(&String.contains?(&1, "."))
|
||||
|> MapSet.new()
|
||||
|
||||
live_methods =
|
||||
BDS.Scripting.Capabilities.for_project("project-id")
|
||||
|> Enum.flat_map(fn {module_name, functions} ->
|
||||
Enum.map(Map.keys(functions), fn function_name -> "#{module_name}.#{function_name}" end)
|
||||
end)
|
||||
|> MapSet.new()
|
||||
|
||||
assert documented_methods == live_methods
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user