clear caches before test

deepsource-autofix-76c6eb20
Dan Gowans 2023-03-31 09:44:16 -04:00
parent 059917f43d
commit 2916750d6d
5 changed files with 25 additions and 0 deletions

View File

@ -19,4 +19,5 @@ export declare function getWorkOrderMilestoneTypes(): Promise<recordTypes.WorkOr
export declare function getWorkOrderMilestoneTypeById(workOrderMilestoneTypeId: number): Promise<recordTypes.WorkOrderMilestoneType | undefined>;
export declare function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string): Promise<recordTypes.WorkOrderMilestoneType | undefined>;
export declare function preloadCaches(): Promise<void>;
export declare function clearCaches(): void;
export declare function clearCacheByTableName(tableName: string, relayMessage?: boolean): void;

View File

@ -169,6 +169,14 @@ export async function preloadCaches() {
await getWorkOrderTypes();
await getWorkOrderMilestoneTypes();
}
export function clearCaches() {
clearLotOccupantTypesCache();
clearLotStatusesCache();
clearLotTypesCache();
clearOccupancyTypesCache();
clearWorkOrderTypesCache();
clearWorkOrderMilestoneTypesCache();
}
function clearWorkOrderMilestoneTypesCache() {
workOrderMilestoneTypes = undefined;
}

View File

@ -308,6 +308,15 @@ export async function preloadCaches(): Promise<void> {
await getWorkOrderMilestoneTypes()
}
export function clearCaches(): void {
clearLotOccupantTypesCache()
clearLotStatusesCache()
clearLotTypesCache()
clearOccupancyTypesCache()
clearWorkOrderTypesCache()
clearWorkOrderMilestoneTypesCache()
}
function clearWorkOrderMilestoneTypesCache(): void {
workOrderMilestoneTypes = undefined
}

View File

@ -16,6 +16,9 @@ describe('config.cemetery.ssm', () => {
describe('functions.cache', () => {
const badId = -3;
const badName = 'qwertyuiopasdfghjklzxcvbnm';
before(() => {
cacheFunctions.clearCaches();
});
describe('Lot Occupant Types', () => {
it('returns Lot Occupant Types', async () => {
cacheFunctions.clearCacheByTableName('LotOccupantTypes');

View File

@ -25,6 +25,10 @@ describe('functions.cache', () => {
const badId = -3
const badName = 'qwertyuiopasdfghjklzxcvbnm'
before(() => {
cacheFunctions.clearCaches()
})
describe('Lot Occupant Types', () => {
it('returns Lot Occupant Types', async () => {
cacheFunctions.clearCacheByTableName('LotOccupantTypes')