Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(`doesn't resolve bootstrapPromise, mountPromise, or unmountPromise with any values`, () => {
const parcelConfig = createParcelConfig();
const parcel = singleSpa.mountRootParcel(parcelConfig, {domElement: document.createElement('div')});
expect(parcel.getStatus()).toBe(singleSpa.NOT_BOOTSTRAPPED);
return parcel
.bootstrapPromise
.then(value => {
expect(value).toBe(null);
return parcel.mountPromise;
})
.then(value => {
expect(value).toBe(null);
return Promise.all([
parcel.unmountPromise,
parcel.unmount(),
]);
})
.then(values => {
const [unmountPromiseValue, unmountValue] = values;
it(`can mount and unmount root parcels`, () => {
const parcelConfig = createParcelConfig();
const parcel = singleSpa.mountRootParcel(parcelConfig, {domElement: document.createElement('div')});
expect(parcel.getStatus()).toBe(singleSpa.NOT_BOOTSTRAPPED);
return parcel
.mountPromise
.then(() => {
expect(parcel.getStatus()).toBe(singleSpa.MOUNTED);
})
.then(() => new Promise((resolve, reject) => {
setTimeout(resolve, 20);
}))
.then(parcel.unmount)
.then(() => {
expect(parcel.getStatus()).toBe(singleSpa.NOT_MOUNTED);
})
});
.then(() => {
expect(singleSpa.getAppStatus('invalid-load-4')).toBe(singleSpa.NOT_BOOTSTRAPPED);
}))
})
.then(() => {
expect(app.bootstrapCalls).toBe(1);
expect(app.mountCalls).toBe(1);
expect(app.unmountCalls).toBe(0);
parcel = app.mountProps.mountParcel(parcelConfig, {domElement: document.createElement('div')});
parcel.unmountPromise
.then(() => unmountPromiseHasResolved = true)
expect(parcel.getStatus()).toBe(singleSpa.NOT_BOOTSTRAPPED);
expect(unmountPromiseHasResolved).toBe(false);
return parcel
.bootstrapPromise
.then(() => {
expect(parcel.getStatus()).toBe(singleSpa.NOT_MOUNTED);
expect(unmountPromiseHasResolved).toBe(false);
return parcel
.mountPromise
.then(() => {
expect(parcel.getStatus()).toBe(singleSpa.MOUNTED);
expect(unmountPromiseHasResolved).toBe(false);
expect(parcelConfig.bootstrapCalls).toBe(1);
expect(parcelConfig.mountCalls).toBe(1);
expect(parcelConfig.unmountCalls).toBe(0);