mattermost-mobile/test/sanity.test.js
Harrison Healey 8e59ea606e Refactored post store to store posts by their IDs (#142)
* Added hook to tests to catch uncaught promise rejections

* Refactored post store to store posts by their IDs

* Fixed post store when logging out
2016-12-19 14:37:54 -03:00

36 lines
945 B
JavaScript

// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import 'react-native';
// Set up a global hooks to make debugging tests less of a pain
before(() => {
process.on('unhandledRejection', (reason) => {
// Rethrow so that tests will actually fail and not just timeout
throw reason;
});
});
// Ensure that everything is imported correctly for testing
describe('Sanity test', () => {
it('Promise', (done) => {
Promise.resolve(true).then(() => {
done();
}).catch((err) => {
done(err);
});
});
it('async/await', async () => {
await Promise.resolve(true);
});
it('fetch', (done) => {
fetch('http://example.com').then(() => {
done();
}).catch(() => {
// No internet connection, but fetch still returned at least
done();
});
});
});