Instant.from.js 870 B

1234567891011121314151617181920212223
  1. describe("correct behavior", () => {
  2. test("length is 1", () => {
  3. expect(Temporal.Instant.from).toHaveLength(1);
  4. });
  5. test("Instant instance argument", () => {
  6. const instant = new Temporal.Instant(123n);
  7. expect(Temporal.Instant.from(instant).epochNanoseconds).toBe(123n);
  8. });
  9. test("ZonedDateTime instance argument", () => {
  10. const timeZone = new Temporal.TimeZone("UTC");
  11. const zonedDateTime = new Temporal.ZonedDateTime(123n, timeZone);
  12. expect(Temporal.Instant.from(zonedDateTime).epochNanoseconds).toBe(123n);
  13. });
  14. // Un-skip once ParseISODateTime & ParseTemporalTimeZoneString are implemented
  15. test.skip("Instant string argument", () => {
  16. expect(Temporal.Instant.from("1975-02-02T14:25:36.123456789Z").epochNanoseconds).toBe(
  17. 160583136123456789n
  18. );
  19. });
  20. });