function checkNode(node) {
    'use strict';
    if (array.length <= i) {
      fail(
          'Got more nodes than expected: ' +
          goog.testing.dom.describeNode_(node));
    }
    const expected = array[i];

    if (goog.dom.isNodeLike(expected)) {
      assertEquals('Nodes should match at position ' + i, expected, node);
    } else if (typeof expected === 'number') {
      assertEquals(
          'Node types should match at position ' + i, expected, node.nodeType);
    } else if (expected.charAt(0) == '#') {
      assertEquals(
          'Expected element at position ' + i, goog.dom.NodeType.ELEMENT,
          node.nodeType);
      const expectedId = expected.slice(1);
      assertEquals('IDs should match at position ' + i, expectedId, node.id);

    } else {
      assertEquals(
          'Expected text node at position ' + i, goog.dom.NodeType.TEXT,
          node.nodeType);
      assertEquals(
          'Node contents should match at position ' + i, expected,
          node.nodeValue);
    }

    i++;
  }
Tests if the given iterator over nodes matches the given Array of node
descriptors.  Throws an error if any match fails.
@param {!goog.iter.Iterator} it  An iterator over nodes.
@param {!Array<!Node|number|string>} array Array of node descriptors to match
    against.  Node descriptors can be any of the following:
        Node: Test if the two nodes are equal.
        number: Test node.nodeType == number.
        string starting with '#': Match the node's id with the text
            after "#".
        other string: Match the text node's contents.
@suppress {strictMissingProperties} charAt on union type