2023-08-18 10:31:45 +02:00
|
|
|
/* eslint-disable jest/require-top-level-describe */
|
2023-07-27 16:41:57 +02:00
|
|
|
|
2023-08-18 10:31:45 +02:00
|
|
|
const { shimInit } = require('@joplin/lib/shim-init-node');
|
|
|
|
const sqlite3 = require('sqlite3');
|
|
|
|
const SyncTargetNone = require('@joplin/lib/SyncTargetNone').default;
|
2023-12-15 20:34:21 +02:00
|
|
|
require('../../jest.base-setup.js')();
|
2023-07-27 16:41:57 +02:00
|
|
|
|
2023-08-18 10:31:45 +02:00
|
|
|
// Mock the S3 sync target -- the @aws-s3 libraries depend on an old version
|
|
|
|
// of uuid that doesn't work with jest without additional configuration.
|
|
|
|
jest.doMock('@joplin/lib/SyncTargetAmazonS3', () => {
|
|
|
|
return SyncTargetNone;
|
|
|
|
});
|
2023-07-27 16:41:57 +02:00
|
|
|
|
|
|
|
// @electron/remote requires electron to be running. Mock it.
|
|
|
|
jest.mock('@electron/remote', () => {
|
2023-08-04 11:57:54 +02:00
|
|
|
return {
|
|
|
|
require: () => {
|
|
|
|
return {
|
|
|
|
default: {},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
2023-07-27 16:41:57 +02:00
|
|
|
});
|
2023-08-18 10:31:45 +02:00
|
|
|
|
|
|
|
// Import after mocking problematic libraries
|
|
|
|
const { afterEachCleanUp, afterAllCleanUp } = require('@joplin/lib/testing/test-utils.js');
|
2024-09-27 16:25:55 +02:00
|
|
|
const React = require('react');
|
2023-08-18 10:31:45 +02:00
|
|
|
|
2024-09-27 16:25:55 +02:00
|
|
|
shimInit({ nodeSqlite: sqlite3, React });
|
2023-08-18 10:31:45 +02:00
|
|
|
|
|
|
|
afterEach(async () => {
|
|
|
|
await afterEachCleanUp();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
await afterAllCleanUp();
|
|
|
|
});
|
|
|
|
|