tests: added tests for renderTopLanguages & top-langs

This commit is contained in:
anuraghazra
2020-07-21 18:04:58 +05:30
parent b50555ad9a
commit 7c104cf8c5
4 changed files with 367 additions and 8 deletions

View File

@ -1,11 +1,17 @@
require("dotenv").config();
const { renderError, clampValue, CONSTANTS } = require("../src/utils");
const {
renderError,
clampValue,
parseBoolean,
CONSTANTS,
} = require("../src/utils");
const fetchTopLanguages = require("../src/fetchTopLanguages");
const renderTopLanguages = require("../src/renderTopLanguages");
module.exports = async (req, res) => {
const {
username,
hide_title,
card_width,
title_color,
text_color,
@ -34,6 +40,7 @@ module.exports = async (req, res) => {
res.send(
renderTopLanguages(topLangs, {
theme,
hide_title: parseBoolean(hide_title),
card_width: parseInt(card_width, 10),
title_color,
text_color,