add class tests to optional async transformers
This commit is contained in:
parent
0a851ced19
commit
a821b2249b
5
test/fixtures/transformation/async-to-generator/async/actual.js
vendored
Normal file
5
test/fixtures/transformation/async-to-generator/async/actual.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
async foo() {
|
||||
var wat = await bar();
|
||||
}
|
||||
}
|
||||
22
test/fixtures/transformation/async-to-generator/async/expected.js
vendored
Normal file
22
test/fixtures/transformation/async-to-generator/async/expected.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
var _asyncToGenerator = function (fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(gen.next); var callThrow = step.bind(gen["throw"]); function step(arg) { try { var info = this(arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; };
|
||||
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {}
|
||||
|
||||
_prototypeProperties(Foo, null, {
|
||||
foo: {
|
||||
value: _asyncToGenerator(function* () {
|
||||
var wat = yield bar();
|
||||
}),
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
5
test/fixtures/transformation/bluebird-coroutines/class/actual.js
vendored
Normal file
5
test/fixtures/transformation/bluebird-coroutines/class/actual.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
async foo() {
|
||||
var wat = await bar();
|
||||
}
|
||||
}
|
||||
22
test/fixtures/transformation/bluebird-coroutines/class/expected.js
vendored
Normal file
22
test/fixtures/transformation/bluebird-coroutines/class/expected.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
var _bluebird = require("bluebird");
|
||||
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {}
|
||||
|
||||
_prototypeProperties(Foo, null, {
|
||||
foo: {
|
||||
value: _bluebird.coroutine(function* () {
|
||||
var wat = yield bar();
|
||||
}),
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user