chromium/third_party/blink/web_tests/http/tests/notifications/triggers.html

<!doctype html>
<html>
  <head>
    <title>Triggers: The Trigger objects exposes the expected properties.</title>
    <script src="../resources/testharness.js"></script>
    <script src="../resources/testharnessreport.js"></script>
  </head>
  <body>
    <script>
      // Tests that the TimestampTrigger object exposes the properties per the
      // semantics defined by the specification.
      test(function () {
          const timestamp = Date.now();
          const trigger = new TimestampTrigger(timestamp);

          // timestamp property gets initialized in constructor
          assert_equals(trigger.timestamp, timestamp);

          // timestap property is readonly
          trigger.timestamp = 42;
          assert_equals(trigger.timestamp, timestamp);

          // timestamp is required in constructor
          assert_throws_js(TypeError, () => new TimestampTrigger());

          // invalid timestamps get set to 0
          assert_equals((new TimestampTrigger('fail')).timestamp, 0);

          // can use date objects as timestamp
          const date = new Date();
          assert_equals((new TimestampTrigger(date)).timestamp, date.valueOf());

      }, 'Checks the properties exposed on the TimestampTrigger object.');
    </script>
  </body>
</html>