Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cicero tests do not take into account the timezone when current time is set #467

Closed
jeromesimeon opened this issue Oct 30, 2019 · 1 comment
Assignees
Labels
0.20 Type: Bug 🐛 Something isn't working

Comments

@jeromesimeon
Copy link
Member

This test from accordproject/cicero-template-library#299 succeeds on my local machine (and fails in travis):

Feature: Certificate of Incorporation
  This describe the expected behavior for the Accord Project's certificate of incorporation contract

  Background:
    Given the default contract

  Scenario: The contract can be signed and emit information about the incorporation
    When the current time is "2019-01-31T16:34:00-00:00"
    And it receives the request
"""
{
    "$class": "org.accordproject.signature.ContractSigned",
    "contract": "MY_CONTRACT"
}
"""
    Then it should respond with
"""
{
    "$class": "org.accordproject.cicero.runtime.Response"
}
"""
    And the following obligations should have been emitted
"""
[
    {
      "$class": "org.accordproject.incorporation.ContractData",
      "companyName": "ACME",
      "incorporationDate": "2019-04-01T00:00:00.000-04:00",
      "authorizedShareCapital": 400,
      "parValue": 0.1
    }
]
"""

but it shouldn't since the the current time is set to the +00:00 timezone!

Cicero parse seems to be doing the right thing:

bash-3.2$ cicero parse 
15:16:15 - info: Using current directory as template folder
15:16:15 - info: Loading a default text/sample.md file.
15:16:17 - info:
{
  "$class": "org.accordproject.incorporation.IncorporationCertificate",
  "contractId": "d20747a9-57c0-4b97-a4a9-1661b8bbaa90",
  "companyName": "ACME",
  "incorporationState": "NY",
  "streetAddress": "555 main street",
  "addressRegion": "Manhattan",
  "addressLocality": "New York",
  "postalCode": "10001",
  "registeredAgentName": "Andie Agent",
  "incorporationDate": "2019-04-01T00:00:00.000-04:00",
  "authorizedShareCapital": 400,
  "parValue": 0.1,
  "incorporatorName": "FooBarAtor",
  "incorporatorAddress": "555 oak street",
  "incorporatorCity": "Baltimore",
  "incorporatorState": "MD",
  "incorporatorZip": "21201"
}
bash-3.2$ cicero parse --currentTime 2019-10-10T00:00:00Z
15:16:22 - info: Using current directory as template folder
15:16:22 - info: Loading a default text/sample.md file.
15:16:25 - info:
{
  "$class": "org.accordproject.incorporation.IncorporationCertificate",
  "contractId": "98fc91fa-9efd-4798-8a68-eea200b7da2e",
  "companyName": "ACME",
  "incorporationState": "NY",
  "streetAddress": "555 main street",
  "addressRegion": "Manhattan",
  "addressLocality": "New York",
  "postalCode": "10001",
  "registeredAgentName": "Andie Agent",
  "incorporationDate": "2019-04-01T00:00:00.000+00:00",
  "authorizedShareCapital": 400,
  "parValue": 0.1,
  "incorporatorName": "FooBarAtor",
  "incorporatorAddress": "555 oak street",
  "incorporatorCity": "Baltimore",
  "incorporatorState": "MD",
  "incorporatorZip": "21201"
}
bash-3.2$ 
@jeromesimeon jeromesimeon self-assigned this Oct 30, 2019
@jeromesimeon jeromesimeon transferred this issue from accordproject/ergo Oct 30, 2019
@jeromesimeon jeromesimeon added 0.20 Type: Bug 🐛 Something isn't working labels Oct 30, 2019
@jeromesimeon
Copy link
Member Author

Fixed in PR #465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.20 Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant