Skip to content

Commit ebb0d10

Browse files
committed
fix tests
1 parent 3570cdb commit ebb0d10

File tree

1 file changed

+95
-95
lines changed

1 file changed

+95
-95
lines changed

test/Wasm.spec.js

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ describe('Wasm', () => {
445445
</Wasm>
446446
);
447447

448-
delay(2000).then(() => {
448+
setTimeout(() => {
449449
expect(result).toMatchObject({
450450
loading: false,
451451
error: null
@@ -487,24 +487,24 @@ describe('Wasm', () => {
487487
});
488488
expect(testRenderer.toJSON()).toMatchSnapshot();
489489

490-
return delay(2000);
491-
}).then(() => {
492-
expect(result).toMatchObject({
493-
loading: false,
494-
error: null
495-
});
496-
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
497-
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
498-
expect(result.data.instance.exports.add_js).toBeTruthy();
499-
expect(result.data.instance.exports.div).toBeFalsy();
500-
expect(testRenderer.toJSON()).toMatchSnapshot();
501-
502-
expect(spy).toHaveBeenCalled();
503-
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
504-
spy.mockRestore();
505-
506-
done();
507-
});
490+
setTimeout(() => {
491+
expect(result).toMatchObject({
492+
loading: false,
493+
error: null
494+
});
495+
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
496+
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
497+
expect(result.data.instance.exports.add_js).toBeTruthy();
498+
expect(result.data.instance.exports.div).toBeFalsy();
499+
expect(testRenderer.toJSON()).toMatchSnapshot();
500+
501+
expect(spy).toHaveBeenCalled();
502+
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
503+
spy.mockRestore();
504+
505+
done();
506+
}, 2000);
507+
}, 2000);
508508
});
509509

510510
it('should reinstantiate module on bufferSource change', done => {
@@ -535,7 +535,7 @@ describe('Wasm', () => {
535535
</Wasm>
536536
);
537537

538-
delay(2000).then(() => {
538+
setTimeout(() => {
539539
expect(result).toMatchObject({
540540
loading: false,
541541
error: null
@@ -577,24 +577,24 @@ describe('Wasm', () => {
577577
});
578578
expect(testRenderer.toJSON()).toMatchSnapshot();
579579

580-
return delay(2000);
581-
}).then(() => {
582-
expect(result).toMatchObject({
583-
loading: false,
584-
error: null
585-
});
586-
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
587-
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
588-
expect(result.data.instance.exports.add_js).toBeTruthy();
589-
expect(result.data.instance.exports.div).toBeFalsy();
590-
expect(testRenderer.toJSON()).toMatchSnapshot();
591-
592-
expect(spy).toHaveBeenCalled();
593-
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
594-
spy.mockRestore();
595-
596-
done();
597-
});
580+
setTimeout(() => {
581+
expect(result).toMatchObject({
582+
loading: false,
583+
error: null
584+
});
585+
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
586+
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
587+
expect(result.data.instance.exports.add_js).toBeTruthy();
588+
expect(result.data.instance.exports.div).toBeFalsy();
589+
expect(testRenderer.toJSON()).toMatchSnapshot();
590+
591+
expect(spy).toHaveBeenCalled();
592+
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
593+
spy.mockRestore();
594+
595+
done();
596+
}, 2000);
597+
}, 2000);
598598
});
599599

600600
it('should not reinstantiate module if url doesn\'t change', done => {
@@ -625,7 +625,7 @@ describe('Wasm', () => {
625625
</Wasm>
626626
);
627627

628-
delay(2000).then(() => {
628+
setTimeout(() => {
629629
expect(result).toMatchObject({
630630
loading: false,
631631
error: null
@@ -667,24 +667,24 @@ describe('Wasm', () => {
667667
});
668668
expect(testRenderer.toJSON()).toMatchSnapshot();
669669

670-
return delay(2000);
671-
}).then(() => {
672-
expect(result).toMatchObject({
673-
loading: false,
674-
error: null
675-
});
676-
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
677-
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
678-
expect(result.data.instance.exports.add).toBeTruthy();
679-
expect(result.data.instance.exports.div).toBeTruthy();
680-
expect(testRenderer.toJSON()).toMatchSnapshot();
681-
682-
expect(spy).not.toHaveBeenCalled();
683-
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
684-
spy.mockRestore();
685-
686-
done();
687-
});
670+
setTimeout(() => {
671+
expect(result).toMatchObject({
672+
loading: false,
673+
error: null
674+
});
675+
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
676+
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
677+
expect(result.data.instance.exports.add).toBeTruthy();
678+
expect(result.data.instance.exports.div).toBeTruthy();
679+
expect(testRenderer.toJSON()).toMatchSnapshot();
680+
681+
expect(spy).not.toHaveBeenCalled();
682+
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
683+
spy.mockRestore();
684+
685+
done();
686+
}, 2000);
687+
}, 2000);
688688
});
689689

690690
it('should not reinstantiate module if bufferSource doesn\'t change', done => {
@@ -715,7 +715,7 @@ describe('Wasm', () => {
715715
</Wasm>
716716
);
717717

718-
delay(2000).then(() => {
718+
setTimeout(() => {
719719
expect(result).toMatchObject({
720720
loading: false,
721721
error: null
@@ -757,24 +757,24 @@ describe('Wasm', () => {
757757
});
758758
expect(testRenderer.toJSON()).toMatchSnapshot();
759759

760-
return delay(2000);
761-
}).then(() => {
762-
expect(result).toMatchObject({
763-
loading: false,
764-
error: null
765-
});
766-
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
767-
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
768-
expect(result.data.instance.exports.add).toBeTruthy();
769-
expect(result.data.instance.exports.div).toBeTruthy();
770-
expect(testRenderer.toJSON()).toMatchSnapshot();
771-
772-
expect(spy).not.toHaveBeenCalled();
773-
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
774-
spy.mockRestore();
775-
776-
done();
777-
});
760+
setTimeout(() => {
761+
expect(result).toMatchObject({
762+
loading: false,
763+
error: null
764+
});
765+
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
766+
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
767+
expect(result.data.instance.exports.add).toBeTruthy();
768+
expect(result.data.instance.exports.div).toBeTruthy();
769+
expect(testRenderer.toJSON()).toMatchSnapshot();
770+
771+
expect(spy).not.toHaveBeenCalled();
772+
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
773+
spy.mockRestore();
774+
775+
done();
776+
}, 2000);
777+
}, 2000);
778778
});
779779

780780
it('should not reinstantiate module if bufferSource changes but url is defined', done => {
@@ -805,7 +805,7 @@ describe('Wasm', () => {
805805
</Wasm>
806806
);
807807

808-
delay(2000).then(() => {
808+
setTimeout(() => {
809809
expect(result).toMatchObject({
810810
loading: false,
811811
error: null
@@ -847,23 +847,23 @@ describe('Wasm', () => {
847847
});
848848
expect(testRenderer.toJSON()).toMatchSnapshot();
849849

850-
return delay(2000);
851-
}).then(() => {
852-
expect(result).toMatchObject({
853-
loading: false,
854-
error: null
855-
});
856-
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
857-
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
858-
expect(result.data.instance.exports.add).toBeTruthy();
859-
expect(result.data.instance.exports.div).toBeTruthy();
860-
expect(testRenderer.toJSON()).toMatchSnapshot();
861-
862-
expect(spy).not.toHaveBeenCalled();
863-
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
864-
spy.mockRestore();
865-
866-
done();
867-
});
850+
setTimeout(() => {
851+
expect(result).toMatchObject({
852+
loading: false,
853+
error: null
854+
});
855+
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
856+
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
857+
expect(result.data.instance.exports.add).toBeTruthy();
858+
expect(result.data.instance.exports.div).toBeTruthy();
859+
expect(testRenderer.toJSON()).toMatchSnapshot();
860+
861+
expect(spy).not.toHaveBeenCalled();
862+
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
863+
spy.mockRestore();
864+
865+
done();
866+
}, 2000);
867+
}, 2000);
868868
});
869869
});

0 commit comments

Comments
 (0)