package com.ruoyi.test;

import com.ruoyi.cai.rank.RankManager;
import com.ruoyi.cai.rank.RankNode;
import com.ruoyi.cai.service.RankService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalDate;
import java.util.List;

/**
 * 带参数单元测试案例
 *
 * @author Lion Li
 */
@SpringBootTest
@Slf4j
public class CaiUnitTest {

    @Autowired
    private RankManager rankManager;
    @Autowired
    private RankService rankService;

    @Test
    public void rank(){
        List<RankNode> nodes = rankManager.getLoveRankToday(9);
        for (RankNode node : nodes) {
            log.info("userId={}, score={}", node.getUserId(),node.getScore());
        }
        nodes = rankManager.getLoveRankLastDay(9);
        for (RankNode node : nodes) {
            log.info("userId={}, score={}", node.getUserId(),node.getScore());
        }
        nodes = rankManager.getInviteRankToday(9);
        for (RankNode node : nodes) {
            log.info("userId={}, score={}", node.getUserId(),node.getScore());
        }
    }
    @Test
    public void saveRank(){
        rankService.saveDayRank(LocalDate.now(),1);
    }

}
