Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(() => {
// it shouldn't be mounted again
expect(myApp.numMounts()).toEqual(1);
expect(singleSpa.getMountedApps()).toEqual([]);
expect(singleSpa.getAppStatus('./unmount-rejects.app.js')).toEqual('SKIP_BECAUSE_BROKEN');
})
})
.then(() => {
expect(myApp.numUnmounts()).toEqual(1);
expect(singleSpa.getMountedApps()).toEqual([]);
expect(singleSpa.getAppStatus('./unmount-times-out-dies.app.js')).toEqual('SKIP_BECAUSE_BROKEN');
})
});
.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');
})
});
() => {
const mountedApps = getMountedApps();
if (!mountedApps.length) {
navigateToUrl(defaultAppLink);
}
},
{ once: true },
getActiveApp() {
const mountedApps = singleSpa.getMountedApps()
for (let i = 0; i < mountedApps.length; i++) {
const app = mountedApps[i]
if (this.apps[app] !== undefined) {
return this.apps[app]
}
}
}
}
.then(() => {
expect(myApp.wasBootstrapped()).toEqual(true);
expect(myApp.wasMounted()).toEqual(true);
expect(singleSpa.getMountedApps()).toEqual(['./bootstrap-times-out.app.js']);
expect(singleSpa.getAppStatus('./bootstrap-times-out.app.js')).toEqual(singleSpa.MOUNTED);
expect(errs.length).toBe(0);
})
});
.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);
})
});
.then(() => {
expect(myApp.wasBootstrapped()).toEqual(true);
expect(myApp.wasMounted()).toEqual(true);
expect(singleSpa.getMountedApps()).toEqual(['./returns-non-native-promise.app.js']);
location.hash = '#something-else';
return singleSpa
.triggerAppChange()
.then(() => {
expect(myApp.wasBootstrapped()).toEqual(true);
expect(myApp.wasUnmounted()).toEqual(true);
expect(singleSpa.getMountedApps()).toEqual([]);
})
})
})
.then(() => {
expect(bootstrapped).toEqual(true);
expect(mounted).toEqual(false);
expect(singleSpa.getMountedApps()).toEqual([]);
})
})
.then(() => {
expect(myApp.isBootstrapped()).toEqual(false);
expect(singleSpa.getMountedApps()).toEqual([]);
expect(singleSpa.getAppStatus('./invalid-no-mount.app.js')).toEqual('SKIP_BECAUSE_BROKEN');
})
});