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

Improved type safety tests #494

Merged
merged 9 commits into from
Jul 11, 2019
Merged

Commits on Jul 9, 2019

  1. Combinatorial enumeration helper

    Add a utility function which calls the provided closure for all possible
    combination of arguments from the provided arrays. This function allows
    testing multiple combinations of various invalid arguments and ensure
    that we don't miss any of them. Enjoy your dynamic typing experience.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    5452f2d View commit details
    Browse the repository at this point in the history
  2. Strict type checks in key generation functions

    Add tests to verify that key generation functions do not accept any
    generally invalid arguments, such as "null", "undefined", etc. We
    accept only byte arrays. No strings, no integer arrays, no promises
    of arrays. Just Monika^W bytes.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    e0cb760 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    84526dd View commit details
    Browse the repository at this point in the history
  4. Strict type checks in Secure Cell

    Ensure that we disallow any unexpected types in Secure Cell input.
    
    There are a few exceptions from the generally invalid types:
    
      - Secure Cell accepts "null" values for context in Seal and
        Token Protect modes. But not for other arguments, and not
        in the Context Imprint mode.
    
      - Context Imprint mode has a custom error for "undefined" context
        value which is possible if the user omits the context argument
        (mistakingly assuming that it is optional)
    
    In all other cases we expect a TypeError to be thrown.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    07b64f4 View commit details
    Browse the repository at this point in the history
  5. Strict type checks in Secure Message

    Ensure that we disallow any unexpected types in Secure Message input.
    The expectations are regular. However, in Secure Message constructor
    we produce Themis errors instead of TypeErrors.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    0268af6 View commit details
    Browse the repository at this point in the history
  6. Strict type checks in Secure Comparatore

    Ensure that we disallow any unexpected types in Secure Comparator.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    9a44a45 View commit details
    Browse the repository at this point in the history
  7. Strict type checks in Secure Session

    Ensure that we disallow any unexpected types in Secure Session.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    53a45be View commit details
    Browse the repository at this point in the history
  8. Keys cannot be constructed from empty strings

    Actually, keys cannot be constructed from any string at the moment,
    but let's test this specifically because we rely on PrivateKey and
    PublicKey to contain valid non-empty keys at all times.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    5515803 View commit details
    Browse the repository at this point in the history
  9. Replace clever hack with standard forEach loop

    It turned out that I did not actually need that combinatorial hack
    so replace it with a more straightforward forEach loop. Well, that
    was a nice exercise.
    ilammy committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    1d92862 View commit details
    Browse the repository at this point in the history