Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

/* Any copyright is dedicated to the Public Domain.
"use strict";
// Test that changing filter state in the middle of taking a snapshot results in
// the properly fitered census.
const {
snapshotState: states,
censusState,
viewState,
const {
setFilterString,
setFilterStringAndRefresh,
const {
takeSnapshotAndCensus,
const {
changeView,
add_task(async function () {
const front = new StubbedMemoryFront();
const heapWorker = new HeapAnalysesClient();
await front.attach();
const store = Store();
const { getState, dispatch } = store;
dispatch(changeView(viewState.CENSUS));
dispatch(takeSnapshotAndCensus(front, heapWorker));
await waitUntilSnapshotState(store, [states.SAVING]);
dispatch(setFilterString("str"));
await waitUntilCensusState(store, snapshot => snapshot.census, [
censusState.SAVED,
]);
equal(getState().filter, "str", "should want filtered trees");
equal(
getState().snapshots[0].census.filter,
"str",
"snapshot-we-were-in-the-middle-of-saving's census should be filtered"
);
dispatch(setFilterStringAndRefresh("", heapWorker));
await waitUntilCensusState(store, snapshot => snapshot.census, [
censusState.SAVING,
]);
ok(true, "changing filter string retriggers census");
ok(!getState().filter, "no longer filtering");
dispatch(setFilterString("obj"));
await waitUntilCensusState(store, snapshot => snapshot.census, [
censusState.SAVED,
]);
equal(getState().filter, "obj", "filtering for obj now");
equal(
getState().snapshots[0].census.filter,
"obj",
"census-we-were-in-the-middle-of-recomputing should be filtered again"
);
heapWorker.destroy();
await front.detach();
});