Create a JavaScript function that takes an array of objects containing information about books (title, author, publication year, and genre) and filters the array based on one or more criteria provided as arguments. The function should return a new array containing only the books that meet the specified criteria. Write test cases to demonstrate the functionality of this function.

Here's a JavaScript function that filters an array of book objects based on the provided criteria:

```javascript
function filterBooks(books, criteria) {
  return books.filter(book => {
    for (const key in criteria) {
      if (book[key] !== criteria[key]) {
        return false;
      }
    }
    return true;
  });
}
```

Here are some test cases to demonstrate the functionality of this function:

```javascript
// Sample data
const books = [
  { title: "Book1", author: "Author1", year: 2000, genre: "Fiction" },
  { title: "Book2", author: "Author2", year: 2010, genre: "Non-Fiction" },
  { title: "Book3", author: "Author1", year: 2020, genre: "Fiction" },
  { title: "Book4", author: "Author3", year: 2005, genre: "Fiction" },
];

// Test case 1: Filter by author
console.log(filterBooks(books, { author: "Author1" }));
/* Output:
[
  { title: 'Book1', author: 'Author1', year: 2000, genre: 'Fiction' },
  { title: 'Book3', author: 'Author1', year: 2020, genre: 'Fiction' }
]
*/

// Test case 2: Filter by genre and year
console.log(filterBooks(books, { genre: "Fiction", year: 2000 }));
/* Output:
[
  { title: 'Book1', author: 'Author1', year: 2000, genre: 'Fiction' }
]
*/

// Test case 3: Filter by non-existing criteria
console.log(filterBooks(books, { publisher: "Publisher1" }));
/* Output:
[]
*/
```

This function uses the `Array.prototype.filter()` method to create a new array containing only the books that meet the specified criteria. The filter callback checks if all the key-value pairs in the provided criteria object match the corresponding properties of each book object. If any property does not match, the book is excluded from the filtered array.