[Tests] Fixes after sessions rework

This commit is contained in:
Alexander Zinchuk 2021-06-24 18:42:16 +03:00
parent 619469078e
commit 206299fd51
3 changed files with 3 additions and 5 deletions

View File

@ -22,7 +22,6 @@ import {
clearStoredSession,
importLegacySession,
clearLegacySessions,
importTestSession,
} from '../../../util/sessions';
addReducer('initApi', (global: GlobalState, actions) => {
@ -30,8 +29,6 @@ addReducer('initApi', (global: GlobalState, actions) => {
if (!IS_TEST) {
await importLegacySession();
void clearLegacySessions();
} else {
importTestSession();
}
void initApi(actions.apiUpdate, {

View File

@ -121,8 +121,8 @@ export async function clearLegacySessions() {
export function importTestSession() {
const sessionJson = process.env.TEST_SESSION!;
try {
const sessionData = JSON.parse(sessionJson) as ApiSessionData;
storeSession(sessionData);
const sessionData = JSON.parse(sessionJson) as ApiSessionData & { userId: number };
storeSession(sessionData, sessionData.userId);
} catch (err) {
if (DEBUG) {
// eslint-disable-next-line no-console

View File

@ -108,6 +108,7 @@ module.exports = (env = {}, argv = {}) => {
APP_ENV: 'production',
TELEGRAM_T_API_ID: '',
TELEGRAM_T_API_HASH: '',
TEST_SESSION: '',
}),
...(argv.mode === 'production' ? [
new BundleAnalyzerPlugin({