function createGenUidStubWithReturns(returnIds) {
  const stub = sinon.stub(Blockly.utils.idGenerator.TEST_ONLY, 'genUid');
  if (Array.isArray(returnIds)) {
    for (let i = 0; i < returnIds.length; i++) {
      stub.onCall(i).returns(returnIds[i]);
    }
  } else {
    stub.returns(returnIds);
  }
  return stub;
}
Creates stub for Blockly.utils.idGenerator.genUid that returns the
provided id or ids.
Recommended to also assert that the stub is called the expected number of
times.
@param {string|!Array<string>} returnIds The return values to use for the
   created stub. If a single value is passed, then the stub always returns
   that value.
@returns {!sinon.SinonStub} The created stub.