How to use the single-spa.getAppStatus function in single-spa

To help you get started, we’ve selected a few single-spa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CanopyTax / single-spa / spec / apps / mount-fails / mount-fails.spec.js View on Github external
.then(() => {
        expect(myApp.wasBootstrapped()).toEqual(true);
        expect(myApp.wasMounted()).toEqual(true);
        expect(myApp.wasUnmounted()).toEqual(true); // We try to unmount an application if it fails to mount.
        expect(singleSpa.getMountedApps()).toEqual([]);
        expect(singleSpa.getAppStatus('./mount-fails.app.js')).toEqual('SKIP_BECAUSE_BROKEN');

        location.hash = '#not-mount-fails';
        return singleSpa
          .triggerAppChange()
          .then(() => {
            expect(myApp.wasUnmounted()).toEqual(true);
            expect(singleSpa.getMountedApps()).toEqual([]);
            expect(singleSpa.getAppStatus('./mount-fails.app.js')).toEqual('SKIP_BECAUSE_BROKEN');
          })
      })
  });
github CanopyTax / single-spa / spec / apps / invalid-unmount / invalid-unmount.spec.js View on Github external
.then(() => {
        expect(myApp.numBootstraps()).toEqual(1);
        expect(myApp.numMounts()).toEqual(1);
        expect(singleSpa.getMountedApps()).toEqual(['./invalid-unmount.app.js']);
        expect(singleSpa.getAppStatus('./invalid-unmount.app.js')).toEqual('MOUNTED');

        // now unmount, which will be the first time it enters a broken state
        location.hash = '#not-invalid-unmount';
        return singleSpa
          .triggerAppChange()
          .then(() => {
            expect(myApp.numBootstraps()).toEqual(1);
            expect(myApp.numMounts()).toEqual(1);
            expect(myApp.numUnmounts()).toEqual(1);
            expect(singleSpa.getMountedApps()).toEqual([]);
            expect(singleSpa.getAppStatus('./invalid-unmount.app.js')).toEqual('SKIP_BECAUSE_BROKEN');

            // now remount and check if it tries to mount despite being in a broken state
            location.hash = activeHash;
            return singleSpa
              .triggerAppChange()
github CanopyTax / single-spa / spec / apps / mount-times-out / mount-times-out.spec.js View on Github external
.then(() => {
        expect(myApp.bootstraps()).toEqual(1);
        expect(myApp.mounts()).toEqual(1);
        expect(singleSpa.getMountedApps()).toEqual(['./mount-times-out.app.js']);
        expect(singleSpa.getAppStatus('./mount-times-out.app.js')).toEqual('MOUNTED');
      })
  });
github CanopyTax / single-spa / spec / apps / invalid-no-mount / invalid-no-mount.spec.js View on Github external
.then(() => {
        expect(myApp.isBootstrapped()).toEqual(false);
        expect(singleSpa.getMountedApps()).toEqual([]);
        expect(singleSpa.getAppStatus('./invalid-no-mount.app.js')).toEqual('SKIP_BECAUSE_BROKEN');
      })
  });
github CanopyTax / single-spa / spec / apps / bootstrap-times-out-dies / bootstrap-times-out-dies.spec.js View on Github external
.then(() => {
        expect(myApp.wasBootstrapped()).toEqual(true);
        expect(myApp.wasMounted()).toEqual(false);
        expect(singleSpa.getMountedApps()).toEqual([]);
        expect(singleSpa.getAppStatus('./bootstrap-times-out-dies.app.js')).toEqual('SKIP_BECAUSE_BROKEN');
        expect(errs.length).toBeGreaterThan(0);
      })
  });
github CanopyTax / single-spa / spec / apps / happy-unload / happy-unload.spec.js View on Github external
.then(() => {
          expect(singleSpa.getAppStatus('./happy-unload.app.js')).toEqual('MOUNTED');
          expect(myApp.getNumBootstrapCalls()).toBe(1);
          expect(myApp.getNumMountCalls()).toBe(1);
          expect(myApp.getNumUnmountCalls()).toBe(0);
          expect(myApp.getNumUnloadCalls()).toBe(0);

          window.location.hash = '#';
          return singleSpa.triggerAppChange();
        })
        .then(() => {
github CanopyTax / single-spa / spec / apps / invalid-no-unmount / invalid-no-unmount.spec.js View on Github external
.then(() => {
        expect(myApp.isBootstrapped()).toEqual(false);
        expect(myApp.isMounted()).toEqual(false);
        expect(singleSpa.getMountedApps()).toEqual([]);
        expect(singleSpa.getAppStatus('./invalid-no-unmount.app.js')).toEqual('SKIP_BECAUSE_BROKEN');
      })
  });