mirror of https://github.com/status-im/metro.git
Fix JSTransformer/index test
Reviewed By: jeanlauliac Differential Revision: D7019771 fbshipit-source-id: cbf232dc22f55d75dced3206b3c4ef1a472a7102
This commit is contained in:
parent
dd48bb1fa3
commit
03c3b3d219
|
@ -34,6 +34,8 @@ describe('Transformer', function() {
|
|||
};
|
||||
|
||||
beforeEach(function() {
|
||||
jest.resetModules();
|
||||
|
||||
Cache = jest.fn();
|
||||
Cache.prototype.get = jest.fn((a, b, c) => c());
|
||||
|
||||
|
@ -54,15 +56,23 @@ describe('Transformer', function() {
|
|||
api[method] = jest.fn();
|
||||
});
|
||||
|
||||
api.transform.mockImplementation(() => {
|
||||
return {
|
||||
result: 'transformed(code)',
|
||||
transformFileStartLogEntry: {},
|
||||
transformFileEndLogEntry: {},
|
||||
};
|
||||
});
|
||||
|
||||
return api;
|
||||
});
|
||||
});
|
||||
|
||||
it('passes transform data to the worker farm when transforming', () => {
|
||||
it('passes transform data to the worker farm when transforming', async () => {
|
||||
const transformOptions = {arbitrary: 'options'};
|
||||
const code = 'arbitrary(code)';
|
||||
|
||||
new Transformer(opts).transform(
|
||||
await new Transformer(opts).transform(
|
||||
fileName,
|
||||
localPath,
|
||||
code,
|
||||
|
|
|
@ -99,7 +99,7 @@ module.exports = class Transformer {
|
|||
assetRegistryPath: string,
|
||||
): Promise<TransformedCode> {
|
||||
try {
|
||||
debug('Started ransforming file', filename);
|
||||
debug('Started transforming file', filename);
|
||||
|
||||
const data = await this._worker.transform(
|
||||
filename,
|
||||
|
|
Loading…
Reference in New Issue