Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasso committed Feb 1, 2019
1 parent 3570cdb commit ebb0d10
Showing 1 changed file with 95 additions and 95 deletions.
190 changes: 95 additions & 95 deletions test/Wasm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ describe('Wasm', () => {
</Wasm>
);

delay(2000).then(() => {
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
Expand Down Expand Up @@ -487,24 +487,24 @@ describe('Wasm', () => {
});
expect(testRenderer.toJSON()).toMatchSnapshot();

return delay(2000);
}).then(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add_js).toBeTruthy();
expect(result.data.instance.exports.div).toBeFalsy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
});
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add_js).toBeTruthy();
expect(result.data.instance.exports.div).toBeFalsy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
}, 2000);
}, 2000);
});

it('should reinstantiate module on bufferSource change', done => {
Expand Down Expand Up @@ -535,7 +535,7 @@ describe('Wasm', () => {
</Wasm>
);

delay(2000).then(() => {
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
Expand Down Expand Up @@ -577,24 +577,24 @@ describe('Wasm', () => {
});
expect(testRenderer.toJSON()).toMatchSnapshot();

return delay(2000);
}).then(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add_js).toBeTruthy();
expect(result.data.instance.exports.div).toBeFalsy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
});
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add_js).toBeTruthy();
expect(result.data.instance.exports.div).toBeFalsy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
}, 2000);
}, 2000);
});

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

delay(2000).then(() => {
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
Expand Down Expand Up @@ -667,24 +667,24 @@ describe('Wasm', () => {
});
expect(testRenderer.toJSON()).toMatchSnapshot();

return delay(2000);
}).then(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add).toBeTruthy();
expect(result.data.instance.exports.div).toBeTruthy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).not.toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
});
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add).toBeTruthy();
expect(result.data.instance.exports.div).toBeTruthy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).not.toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
}, 2000);
}, 2000);
});

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

delay(2000).then(() => {
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
Expand Down Expand Up @@ -757,24 +757,24 @@ describe('Wasm', () => {
});
expect(testRenderer.toJSON()).toMatchSnapshot();

return delay(2000);
}).then(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add).toBeTruthy();
expect(result.data.instance.exports.div).toBeTruthy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).not.toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
});
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add).toBeTruthy();
expect(result.data.instance.exports.div).toBeTruthy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).not.toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
}, 2000);
}, 2000);
});

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

delay(2000).then(() => {
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
Expand Down Expand Up @@ -847,23 +847,23 @@ describe('Wasm', () => {
});
expect(testRenderer.toJSON()).toMatchSnapshot();

return delay(2000);
}).then(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add).toBeTruthy();
expect(result.data.instance.exports.div).toBeTruthy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).not.toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
});
setTimeout(() => {
expect(result).toMatchObject({
loading: false,
error: null
});
expect(result.data.module).toBeInstanceOf(WebAssembly.Module);
expect(result.data.instance).toBeInstanceOf(WebAssembly.Instance);
expect(result.data.instance.exports.add).toBeTruthy();
expect(result.data.instance.exports.div).toBeTruthy();
expect(testRenderer.toJSON()).toMatchSnapshot();

expect(spy).not.toHaveBeenCalled();
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
spy.mockRestore();

done();
}, 2000);
}, 2000);
});
});

0 comments on commit ebb0d10

Please sign in to comment.