summaryrefslogtreecommitdiffstats
path: root/model/manifest_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-09-15 08:51:46 -0400
committerGitHub <noreply@github.com>2017-09-15 08:51:46 -0400
commit2628022275ef64fde95545abe4634b4bd7177844 (patch)
tree25d451b81d720f44aa09b20389be7fbb75b7864e /model/manifest_test.go
parent2a6cd44f23e1b3207debaa73801f0c63a2c81126 (diff)
downloadchat-2628022275ef64fde95545abe4634b4bd7177844.tar.gz
chat-2628022275ef64fde95545abe4634b4bd7177844.tar.bz2
chat-2628022275ef64fde95545abe4634b4bd7177844.zip
PLT-7622 Improvements to server handling of webapp plugins (#7445)
* Improvements to server handling of webapp plugins * Fix newline * Update manifest function names
Diffstat (limited to 'model/manifest_test.go')
-rw-r--r--model/manifest_test.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/model/manifest_test.go b/model/manifest_test.go
index 46975cf47..1ec43a217 100644
--- a/model/manifest_test.go
+++ b/model/manifest_test.go
@@ -129,3 +129,51 @@ func TestManifestJson(t *testing.T) {
assert.Equal(t, newManifestList, manifestList)
assert.Equal(t, ManifestListToJson(newManifestList), json)
}
+
+func TestManifestHasClient(t *testing.T) {
+ manifest := &Manifest{
+ Id: "theid",
+ Backend: &ManifestBackend{
+ Executable: "theexecutable",
+ },
+ Webapp: &ManifestWebapp{
+ BundlePath: "thebundlepath",
+ },
+ }
+
+ assert.True(t, manifest.HasClient())
+
+ manifest.Webapp = nil
+ assert.False(t, manifest.HasClient())
+}
+
+func TestManifestClientManifest(t *testing.T) {
+ manifest := &Manifest{
+ Id: "theid",
+ Name: "thename",
+ Description: "thedescription",
+ Version: "0.0.1",
+ Backend: &ManifestBackend{
+ Executable: "theexecutable",
+ },
+ Webapp: &ManifestWebapp{
+ BundlePath: "thebundlepath",
+ },
+ }
+
+ sanitized := manifest.ClientManifest()
+
+ assert.NotEmpty(t, sanitized.Id)
+ assert.NotEmpty(t, sanitized.Version)
+ assert.NotEmpty(t, sanitized.Webapp)
+ assert.Empty(t, sanitized.Name)
+ assert.Empty(t, sanitized.Description)
+ assert.Empty(t, sanitized.Backend)
+
+ assert.NotEmpty(t, manifest.Id)
+ assert.NotEmpty(t, manifest.Version)
+ assert.NotEmpty(t, manifest.Webapp)
+ assert.NotEmpty(t, manifest.Name)
+ assert.NotEmpty(t, manifest.Description)
+ assert.NotEmpty(t, manifest.Backend)
+}