This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { pathsToModuleNameMapper } = require('ts-jest'); | |
//const { pathsToModuleNameMapper } = require('ts-jest/utils'); // also you can do like this, but jest recommends use one above | |
const { compilerOptions } = require('./tsconfig.json'); | |
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | |
module.exports = { | |
preset: 'ts-jest', | |
testEnvironment: 'node', | |
coverageDirectory: './coverage', | |
testMatch: [ "**/?(*.)+(test).ts" ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { joke, hardJoke, riddle } from '@/content' | |
import getQuote, { getAllQuotes } from '@/helpers/quotes' | |
import { Fact } from '@/types/common.types' | |
export function boredSwitch(topic: string): Fact { | |
switch (topic.toLowerCase()) { | |
case 'quote': | |
return getQuote() | |
break | |
case 'all-quotes': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @description create a to recreate the fibonacci sequence and returns it into an array | |
* @param n total of loops | |
* @returns and array filled with fibonacci sequence | |
* @example [0,1,1,2,3,5,8,13,21...] | |
*/ | |
export function fibonashi(n: number): unknown[] { | |
const a: number[] = [0, 1]; | |
if (n === 1) return [0]; | |
if (n === 2) return [0, 1]; |