Skip to content

Commit

Permalink
Remove stale test util for detecting await support. (stripe#1290)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe authored Nov 9, 2021
1 parent 3811c5d commit 1aa8cef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
26 changes: 11 additions & 15 deletions test/autoPagination.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,17 @@ describe('auto pagination', function() {
).to.eventually.deep.equal(realCustomerIds));
}

if (testUtils.envSupportsAwait()) {
// Similarly, `await` throws a syntax error below Node 7.6.
const awaitUntil = require('../testUtils/await.node7').awaitUntil;

it('works with `await` and a while loop when await exists', () =>
expect(
new Promise((resolve, reject) => {
awaitUntil(stripe.customers.list({limit: 3, email}), LIMIT)
.then((customers) => {
resolve(customers.map((customer) => customer.id));
})
.catch(reject);
})
).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)));
}
const awaitUntil = require('../testUtils/await.node7').awaitUntil;
it('works with `await` and a while loop when await exists', () =>
expect(
new Promise((resolve, reject) => {
awaitUntil(stripe.customers.list({limit: 3, email}), LIMIT)
.then((customers) => {
resolve(customers.map((customer) => customer.id));
})
.catch(reject);
})
).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)));

it('returns an empty object from .return() so that `break;` works in for-await', () =>
expect(
Expand Down
9 changes: 0 additions & 9 deletions testUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,6 @@ const utils = (module.exports = {
return typeof Symbol !== 'undefined' && Symbol.asyncIterator;
},

envSupportsAwait: () => {
try {
eval('(async function() {})'); // eslint-disable-line no-eval
return true;
} catch (err) {
return false;
}
},

FakeCryptoProvider: class extends CryptoProvider {
computeHMACSignature(payload, secret) {
return 'fake signature';
Expand Down

0 comments on commit 1aa8cef

Please sign in to comment.