Add more tests
snippets/6/t/post_empty_items.t
my $res2 = $test->request( POST '/api/v2/item', { text => '' } ); is $res2->content, '{"error":"No text provided"}'; my $res3 = $test->request( POST '/api/v2/item' ); is $res3->content, '{"error":"No text provided"}';
snippets/6/t/fetch_all_items_again.t
my $get3 = $test->request( GET '/api/v2/items'); my $items3 = decode_json($get3->content); is scalar @{$items3->{items}}, 1; is $items3->{items}[0]{text}, 'First Thing to do';
snippets/6/t/post_item_with_spaces.t
my $res4 = $test->request( POST '/api/v2/item', { text => ' one more ' }); is_deeply decode_json($res4->content), { ok => 1, text => 'one more' }; my $get4 = $test->request( GET '/api/v2/items'); my $items4 = decode_json($get4->content); is scalar @{$items4->{items}}, 2; is $items4->{items}[0]{text}, 'First Thing to do'; is $items4->{items}[1]{text}, 'one more';