Cod sursa(job #3005294)

Utilizator keepcodingTanase Daniel keepcoding Data 16 martie 2023 21:02:23
Problema Submultimi Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.87 kb
subtest "Check username colors for xp tops" => sub {
  $t->reset_session;
  $t->get_ok('/test/set-admin');

  // use this array to update and test the username color for all periods
  my @xp_periods = @SuperSecret::Helper::XpLog::xp_ranking_periods;

  // update the xp of the user
  my $index = 0;
  for my $period (@xp_periods) {
    $t->app->db->resultset('XpRanking')->create({
      period => $period, username => 'user', xp => 2000
    });
    ++$index;
  }

  # update the rating of the user 
  $t->app->db->resultset('User')->by_username('user')
    ->update({ rating => 2700 });

  for my $period (@xp_periods) {
    # open the xp 'period' top page and check 
    # if the color is corresponding to the rating
    $t->get_ok('/top/users/xp/' . lc($period))->status_is(200)
      ->content_like(qr/user".*style="color: #FF3333;">/s);
  }
};

done_testing();