* Add linter rules for import order and type member delimiters * Remove unneeded group * Group all app/* imports before the internal imports * Move app/ imports before parent imports * Separate @node_modules imports into a different group * Substitute app paths by aliases * Fix @node_modules import order and add test related modules * Add aliases for types and test, and group import types
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import assert from 'assert';
|
|
|
|
import nock from 'nock';
|
|
|
|
import {Client4} from '@client/rest';
|
|
import * as Actions from '@mm-redux/actions/files';
|
|
import TestHelper from '@test/test_helper';
|
|
import configureStore from '@test/test_store';
|
|
|
|
describe('Actions.Files', () => {
|
|
let store;
|
|
beforeAll(async () => {
|
|
await TestHelper.initBasic(Client4);
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
store = await configureStore();
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await TestHelper.tearDown();
|
|
});
|
|
|
|
it('getFilePublicLink', async () => {
|
|
const fileId = 't1izsr9uspgi3ynggqu6xxjn9y';
|
|
nock(Client4.getBaseRoute()).
|
|
get(`/files/${fileId}/link`).
|
|
query(true).
|
|
reply(200, {
|
|
link: 'https://mattermost.com/files/ndans23ry2rtjd1z73g6i5f3fc/public?h=rE1-b2N1VVVMsAQssjwlfNawbVOwUy1TRDuTeGC_tys',
|
|
});
|
|
|
|
await Actions.getFilePublicLink(fileId)(store.dispatch, store.getState);
|
|
|
|
const state = store.getState();
|
|
|
|
const filePublicLink = state.entities.files.filePublicLink.link;
|
|
assert.equal('https://mattermost.com/files/ndans23ry2rtjd1z73g6i5f3fc/public?h=rE1-b2N1VVVMsAQssjwlfNawbVOwUy1TRDuTeGC_tys', filePublicLink);
|
|
assert.ok(filePublicLink);
|
|
assert.ok(filePublicLink.length > 0);
|
|
});
|
|
});
|