# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Tests for azure.policy.fn.date_time_to_epoch
builtin: azure.policy.fn.date_time_to_epoch

cases:
  - note: epoch_zero
    args: ["1970-01-01T00:00:00Z"]
    want: 0

  - note: specific_datetime
    args: ["2024-01-15T12:00:00Z"]
    want: 1705320000

  - note: datetime_with_offset
    args: ["2024-01-15T13:00:00+01:00"]
    want: 1705320000

  - note: before_epoch
    args: ["1969-12-31T00:00:00Z"]
    want: -86400

  - note: invalid_datetime
    args: ["not-a-date"]
    want_undefined: true

  - note: non_string_arg
    args: [12345]
    want_undefined: true

  - note: datetime_without_tz
    args: ["2024-01-15T12:00:00"]
    want: 1705320000

  - note: space_separated_datetime
    args: ["2024-01-15 12:00:00"]
    want: 1705320000

  - note: space_separated_datetime_with_z
    args: ["2024-01-15 12:00:00Z"]
    want: 1705320000

  - note: space_separated_datetime_with_offset
    args: ["2024-01-15 13:00:00+01:00"]
    want: 1705320000
