File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
github-workflows-kt/src/test
kotlin/io/github/typesafegithub/workflows/yaml Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class ContextMappingTest :
1010 FunSpec ({
1111 test(" successfully load all supported contexts with all supported fields" ) {
1212 // Given
13- val testGithubContextJson = javaClass.getResource(" /contexts/github.json" )!! .readText()
13+ val testGithubContextJson = javaClass.getResource(" /contexts/github-all-fields .json" )!! .readText()
1414
1515 // When
1616 val contexts =
@@ -36,4 +36,29 @@ class ContextMappingTest :
3636 ),
3737 )
3838 }
39+
40+ test(" successfully load all supported contexts with only required fields" ) {
41+ // Given
42+ val testGithubContextJson = javaClass.getResource(" /contexts/github-required-fields.json" )!! .readText()
43+
44+ // When
45+ val contexts =
46+ loadContextsFromEnvVars(
47+ getenv = mapOf (
48+ " GHWKT_GITHUB_CONTEXT_JSON" to testGithubContextJson,
49+ )::get,
50+ )
51+
52+ // Then
53+ contexts shouldBe
54+ Contexts (
55+ github =
56+ GithubContext (
57+ repository = " some-owner/some-repo" ,
58+ sha = " db76dd0f1149901e1cdf60ec98d568b32fa7eb71" ,
59+ event = GithubContextEvent (),
60+ event_name = " push" ,
61+ ),
62+ )
63+ }
3964 })
File renamed without changes.
Original file line number Diff line number Diff line change 1+ {
2+ "repository" : " some-owner/some-repo" ,
3+ "sha" : " db76dd0f1149901e1cdf60ec98d568b32fa7eb71" ,
4+ "event" : {},
5+ "event_name" : " push"
6+ }
You can’t perform that action at this time.
0 commit comments