fixing graph code and added placeholder pie code
This commit is contained in:
parent
af95b31eb8
commit
b2627eea4f
5 changed files with 114 additions and 60 deletions
|
@ -40,16 +40,68 @@ my $session_key = $framework->login({
|
|||
|
||||
$t->post_ok('/api/v1/customer/graphs' => json => {
|
||||
session_key => $session_key,
|
||||
graph => 'avg_spend_last_week',
|
||||
graph => 'total_last_week',
|
||||
})
|
||||
->status_is(200)->or($framework->dump_error)
|
||||
->json_is('/graph', {
|
||||
labels => [ map { $t->app->format_iso_datetime(
|
||||
$start->clone->subtract( days => $_ )->subtract( hours => 12 )
|
||||
) } reverse ( 0 .. 6 ) ],
|
||||
bounds => {
|
||||
min => $t->app->format_iso_datetime($start->clone->subtract( days => 6 )->subtract( hours => 12 ) ),
|
||||
max => $t->app->format_iso_datetime($start->clone->add( hours => 12 )),
|
||||
},
|
||||
data => [ 20, 40, 20, 30, 30, 40, 10 ],
|
||||
});
|
||||
|
||||
$t->post_ok('/api/v1/customer/graphs' => json => {
|
||||
session_key => $session_key,
|
||||
graph => 'avg_spend_last_week',
|
||||
})
|
||||
->status_is(200)->or($framework->dump_error)
|
||||
->json_is('/graph', {
|
||||
labels => [ map { $t->app->format_iso_datetime(
|
||||
$start->clone->subtract( days => $_ )->subtract( hours => 12 )
|
||||
) } reverse ( 0 .. 29 ) ],
|
||||
bounds => {
|
||||
min => $t->app->format_iso_datetime($start->clone->subtract( days => 6 )->subtract( hours => 12 ) ),
|
||||
max => $t->app->format_iso_datetime($start->clone->add( hours => 12 )),
|
||||
},
|
||||
data => [ 10, 10, 10, 10, 10, 10, 10 ],
|
||||
});
|
||||
|
||||
$t->post_ok('/api/v1/customer/graphs' => json => {
|
||||
session_key => $session_key,
|
||||
graph => 'total_last_month',
|
||||
})
|
||||
->status_is(200)->or($framework->dump_error)
|
||||
->json_is('/graph', {
|
||||
labels => [ map { $t->app->format_iso_datetime(
|
||||
$start->clone->subtract( days => $_ )->subtract( hours => 12 )
|
||||
) } reverse ( 0 .. 29 ) ],
|
||||
bounds => {
|
||||
min => $t->app->format_iso_datetime($start->clone->subtract( days => 29 )->subtract( hours => 12 ) ),
|
||||
max => $t->app->format_iso_datetime($start->clone->add( hours => 12 )),
|
||||
},
|
||||
data => [ 40, 20, 30, 30, 40, 10, 40, 30, 30, 20, 40, 20, 40, 20, 30, 30, 40, 10, 40, 30, 30, 20, 40, 20, 40, 20, 30, 30, 40, 10 ],
|
||||
});
|
||||
|
||||
$t->post_ok('/api/v1/customer/graphs' => json => {
|
||||
session_key => $session_key,
|
||||
graph => 'avg_spend_last_month',
|
||||
})
|
||||
->status_is(200)->or($framework->dump_error)
|
||||
->json_is('/graph', {
|
||||
labels => [ map { $t->app->format_iso_datetime(
|
||||
$start->clone->subtract( days => $_ )->subtract( hours => 12 )
|
||||
) } reverse ( 0 .. 29 ) ],
|
||||
bounds => {
|
||||
min => $t->app->format_iso_datetime($start->clone->subtract( days => 29 )->subtract( hours => 12 ) ),
|
||||
max => $t->app->format_iso_datetime($start->clone->add( hours => 12 )),
|
||||
},
|
||||
data => [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ],
|
||||
});
|
||||
|
||||
$framework->logout( $session_key );
|
||||
|
||||
$session_key = $framework->login({
|
||||
|
|
Reference in a new issue