diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-07-19 10:16:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-19 10:16:44 -0400 |
commit | 1641370fbedc42e07f7a9b7758286d341f13b624 (patch) | |
tree | 0571746e175c7b6da2a5587bda1b8aaca033cc03 /webapp/tests/client_general.test.jsx | |
parent | 2b0fcd378ce96277f393b89cac1a98d70e1c480f (diff) | |
download | chat-1641370fbedc42e07f7a9b7758286d341f13b624.tar.gz chat-1641370fbedc42e07f7a9b7758286d341f13b624.tar.bz2 chat-1641370fbedc42e07f7a9b7758286d341f13b624.zip |
Moving javascript driver back to platform (#3613)
Diffstat (limited to 'webapp/tests/client_general.test.jsx')
-rw-r--r-- | webapp/tests/client_general.test.jsx | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/webapp/tests/client_general.test.jsx b/webapp/tests/client_general.test.jsx new file mode 100644 index 000000000..61e7832da --- /dev/null +++ b/webapp/tests/client_general.test.jsx @@ -0,0 +1,85 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +var assert = require('assert'); +import TestHelper from './test_helper.jsx'; + +describe('Client.General', function() { + this.timeout(10000); + + it('General.getClientConfig', function(done) { + TestHelper.initBasic(() => { + TestHelper.basicClient().getClientConfig( + function(data) { + assert.equal(data.SiteName, 'Mattermost'); + done(); + }, + function(err) { + done(new Error(err.message)); + } + ); + }); + }); + + it('General.getPing', function(done) { + TestHelper.initBasic(() => { + TestHelper.basicClient().getPing( + function(data) { + assert.equal(data.version.length > 0, true); + done(); + }, + function(err) { + done(new Error(err.message)); + } + ); + }); + }); + + it('General.logClientError', function(done) { + TestHelper.initBasic(() => { + var config = {}; + config.site_name = 'test'; + TestHelper.basicClient().logClientError('this is a test'); + done(); + }); + }); + + it('File.getFileInfo', function(done) { + TestHelper.initBasic(() => { + TestHelper.basicClient().enableLogErrorsToConsole(false); // Disabling since this unit test causes an error + + TestHelper.basicClient().getFileInfo( + `/${TestHelper.basicChannel().id}/${TestHelper.basicUser().id}/filename.txt`, + function(data) { + assert.equal(data.filename, 'filename.txt'); + done(); + }, + function(err) { + done(new Error(err.message)); + } + ); + }); + }); + + it('File.getPublicLink', function(done) { + TestHelper.initBasic(() => { + TestHelper.basicClient().enableLogErrorsToConsole(false); // Disabling since this unit test causes an error + var data = {}; + data.channel_id = TestHelper.basicChannel().id; + data.user_id = TestHelper.basicUser().id; + data.filename = `/${TestHelper.basicChannel().id}/${TestHelper.basicUser().id}/filename.txt`; + + TestHelper.basicClient().getPublicLink( + data, + function() { + done(new Error('not enabled')); + }, + function(err) { + assert.equal(err.id, 'api.file.get_public_link.disabled.app_error'); + done(); + } + ); + }); + }); +}); + |