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

add static tests for coercion functions? #189

Open
sherrardb opened this issue Feb 17, 2020 · 1 comment
Open

add static tests for coercion functions? #189

sherrardb opened this issue Feb 17, 2020 · 1 comment
Labels

Comments

@sherrardb
Copy link
Collaborator

similar to the test currently local.t

my $false =  bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' );

  my $DATA = {
    'client_ip' => '138.197.111.110',
    'object' => 'token',
    'type' => 'card',
...
      'customer' => undef,
      'address_line1_check' => undef,
      'address_country' => undef
      }
  };

  Unexpected_keys_ignored: {
    my $obj =  Net::Stripe::_hash_to_object({
            %$DATA,
            'dummy_object' => {
              object  => 'foo_bar',
              garbage => 'bin',
            },
            dummy_scalar => 'rubbish',
    });
    is (ref($obj), 'Net::Stripe::Token', 'unmodelled data has no effect');
    ok (! exists($obj->{dummy_object}), 'dummy_object ignored');
    ok (! exists($obj->{dummy_scalar}), 'dummy_scalar ignored');
  }

we may want to add tests that confirm the expected behavior of _pre_2011_08_01_processing(),
_pre_2012_10_26_processing(), etc.

my testing has always involved forcing the API version with

    $req->header( 'Stripe-Version' => $ENV{STRIPE_API_VERSION} ) if exists( $ENV{STRIPE_API_VERSION} );

and iterating over a range of versions using a bash for loop, but obviously this method is of no benefit for users, cpantesters, etc.

@sherrardb
Copy link
Collaborator Author

methods used on the request side fall into this category as well. and we already have an example:

Placeholder: {
    my $return = { Net::Stripe::Resource::form_fields_for_hashref( "hashref", { level1=> { level2=> "value" } } ) };
    is_deeply $return, { 'hashref[level1][level2]' => 'value' };
}

that section just needs a name change to remove the implication of transience.

sherrardb added a commit that referenced this issue Feb 25, 2020
 * remove temporary naming for static encoding tests, per <#189>
 * add hashref tests for convert_to_form_fields()
 * label object tests for convert_to_form_fields()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant