From 191680ce49a2228710f0bfc6f6236e4f5bd0628b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 24 Jun 2018 02:33:57 -0400 Subject: add some tests --- t/category.t | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 t/category.t (limited to 't/category.t') diff --git a/t/category.t b/t/category.t new file mode 100644 index 0000000..4d38ecc --- /dev/null +++ b/t/category.t @@ -0,0 +1,36 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use lib 't/lib'; + +use WWW::YNAB; +use WWW::YNAB::MockUA; + +my $ua = WWW::YNAB::MockUA->new; +my $ynab = WWW::YNAB->new( + access_token => 'abcdef', + ua => $ua, +); + +is(scalar $ua->test_requests, 0); + +my $budget = $ynab->budget('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'); +is(scalar $ua->test_requests, 1); +isa_ok($budget, 'WWW::YNAB::Budget'); + +my $category = $budget->category('33333333-3333-3333-3333-333333333333'); +is(scalar $ua->test_requests, 2); +isa_ok($category, 'WWW::YNAB::Category'); +is($category->id, "33333333-3333-3333-3333-333333333333"); +is($category->category_group_id, "22222222-2222-2222-2222-333333333333"); +is($category->name, "Restaurants"); +ok(!$category->hidden); +is($category->note, undef); +is($category->budgeted, 234560); +is($category->activity, -34560); +is($category->balance, 200000); +ok(!$category->deleted); + +done_testing; -- cgit v1.2.3-54-g00ecf