2022-10-31 08:09:59 +00:00
|
|
|
import { DatabaseManager } from 'backend/database/manager';
|
2022-04-25 06:33:31 +00:00
|
|
|
import { config } from 'dotenv';
|
2022-10-31 08:09:59 +00:00
|
|
|
import { Fyo } from 'fyo';
|
|
|
|
import { DummyAuthDemux } from 'fyo/tests/helpers';
|
2022-04-24 06:48:44 +00:00
|
|
|
import { SetupWizardOptions } from 'src/setup/types';
|
|
|
|
import { getFiscalYear } from 'utils/misc';
|
|
|
|
|
|
|
|
export function getTestSetupWizardOptions(): SetupWizardOptions {
|
|
|
|
return {
|
2022-04-25 06:33:31 +00:00
|
|
|
logo: null,
|
2022-04-24 06:48:44 +00:00
|
|
|
companyName: 'Test Company',
|
|
|
|
country: 'India',
|
|
|
|
fullname: 'Test Person',
|
|
|
|
email: 'test@testmyfantasy.com',
|
|
|
|
bankName: 'Test Bank of Scriptia',
|
|
|
|
currency: 'INR',
|
|
|
|
fiscalYearStart: getFiscalYear('04-01', true),
|
|
|
|
fiscalYearEnd: getFiscalYear('04-01', false),
|
|
|
|
chartOfAccounts: 'India - Chart of Accounts',
|
|
|
|
};
|
|
|
|
}
|
2022-04-25 06:33:31 +00:00
|
|
|
|
2022-05-10 09:26:17 +00:00
|
|
|
export function getTestDbPath(dbPath?: string) {
|
2022-04-25 06:33:31 +00:00
|
|
|
config();
|
2022-05-10 09:26:17 +00:00
|
|
|
return dbPath ?? process.env.TEST_DB_PATH ?? ':memory:';
|
2022-04-25 06:33:31 +00:00
|
|
|
}
|
2022-10-31 08:09:59 +00:00
|
|
|
|
|
|
|
export function getTestFyo(): Fyo {
|
|
|
|
return new Fyo({
|
|
|
|
DatabaseDemux: DatabaseManager,
|
|
|
|
AuthDemux: DummyAuthDemux,
|
|
|
|
isTest: true,
|
|
|
|
isElectron: false,
|
|
|
|
});
|
|
|
|
}
|