on master help sign in
Add EnvVar JSON tests
commit28ccd69fded58be9d4cf21a27f85e528c9b96d14 authorDaQuirm <leo.daquirm@gmail.com> dateSun 7 Jan 2018, 12:25 (9 years ago) parenta21b349
1 file changed+10
tests/tests.hs+10
tests/tests.hs+10
@@ -163,6 +163,15 @@ testEntrypointJson = testGroup "Testing ContainerConfig JSON" [testSample1, test
163163 Just (Entrypoint sampleEntrypointArr)
164164 sampleEntrypointArr = ["cmd", "--some-flag", "--some-flag2"]
165165
166+testEnvVarJson :: TestTree
167+testEnvVarJson = testGroup "Testing EnvVar JSON" [testSampleEncode, testSampleDecode]
168+ where
169+ testSampleEncode =
170+ testCase "Test toJSON" $ assert $ JSON.toJSON (EnvVar "cellar" "door") == JSON.String "cellar=door"
171+ testSampleDecode =
172+ testCase "Test fromJSON" $ assert $ (JSON.decode "\"cellar=door\"" :: Maybe EnvVar) ==
173+ Just (EnvVar "cellar" "door")
174+
166175integrationTests :: TestTree
167176integrationTests =
168177 testGroup
@@ -183,6 +192,7 @@ jsonTests =
183192 , testLabelsJson
184193 , testLogDriverOptionsJson
185194 , testEntrypointJson
195+ , testEnvVarJson
186196 ]
187197
188198setup :: IO ()