# tokenValid returns true if there is a token and the expiry is in the future
# tokenValid returns false if the token expiry is in the past 
# or if there is no token 
# In the case where invalid credentials are supplied 
# the auth will fail so there will be no token available 

Feature: Is the token valid?
  The adapter tokenValid method works as expected

  Scenario: If adapter has not authed then the tokenValid returns false
    Given valid config
    When the adapter instance is created
    Then tokenValid returns false  

  Scenario: If credentials.expiry is in the future then the token is valid
    Given valid config
    When the adapter instance is created
    When the auth method is called
    When the token expiry is in the future
    Then tokenValid returns true  

  Scenario: If credentials.expiry is in the past then the token is invalid
    Given valid config
    When the adapter instance is created
    When the auth method is called
    When the token expiry is in the past
    Then tokenValid returns false