title: How to test that expires/TTL value is set in Mongoose Schema?
body: <p>I'm using MongoDB's <a href="https://www.mongodb.com/docs/manual/core/index-ttl/" rel="nofollow noreferrer">TTL Index</a> feature to automatically delete documents (in this case, email verification tokens) after a certain amount of time.</p>
  <p>I also use Mongoose, which creates this index via the <code>expires</code> property (on the <code>createdAt</code> timestamp):</p>
  <pre><code>const emailVerifiationTokenSchema = new mongoose.Schema&lt;IEmailVerificationToken&gt;({
      userId: { type: mongoose.Types.ObjectId, required: true },
      email: { type: String, required: true },
      tokenId: { type: String, required: true },
      createdAt: { type: Date, required: true, default: () =&gt; Date.now(), expires: 43200 },
  });
  </code></pre>
  <p><strong>How can I write a test that ensures that I'm setting this value to the correct amount?</strong> There doesn't seem to be a way to access this value from the outside.</p>
  <p>I use Jest for testing.</p>