@adobe/data - v0.10.30
    Preparing search index...

    Function testUpgradeHandlers

    • Guarantee (and run) a unit test for EVERY upgrade handler. Call it once from a co-located test: it walks the history and, for each entry that has a handler, requires a cases[version] — throwing if one is missing — then builds a store at the handler's input version, runs setup, applies the handler via runUpgradeStep, and runs expect. Add a handler without a case and this fails; a case pointing at a version with no handler also fails.

      it("every upgrader is tested", () => testUpgradeHandlers(versions, {
      4: {
      setup: (s) => s.ensureArchetype(["hp"]).insert({ hp: 42 }),
      expect: (s, e) => expect(s.read(e)?.hp).toEqual({ current: 42, max: 42 }),
      },
      }));

      Parameters

      Returns Promise<void>