This file contains hidden or 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
| node_modules | |
| coverage | |
| .env |
This file contains hidden or 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
| PASS __tests__/main.test.ts | |
| Testando a função mascararDados. | |
| ✓ Verificando input vs output da pesquisa de Nerdcast. (2ms) | |
| Testando a função mascararDadosInline. | |
| ✓ Verificando input vs output da pesquisa de Nerdcast. | |
| ----------|----------|----------|----------|----------|-------------------| | |
| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | |
| ----------|----------|----------|----------|----------|-------------------| | |
| All files | 28.26 | 0 | 0 | 28.26 | | |
This file contains hidden or 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
Show hidden characters
| { | |
| "compilerOptions": { | |
| ... | |
| "typeRoots": [ | |
| "node_modules", | |
| "jest" | |
| ], | |
| "types": [ | |
| "node", | |
| "jest" |
This file contains hidden or 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
| /** | |
| * Testes. | |
| */ | |
| 'use strict'; | |
| import { readFile } from 'fs'; | |
| import { join } from 'path'; | |
| import { | |
| mascararDados, | |
| mascararDadosInline |
This file contains hidden or 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
| { | |
| "wrapperType": "track", | |
| "kind": "podcast", | |
| "collectionId": 1103141552, | |
| "trackId": 1103141552, | |
| "artistName": "Nerdcast", | |
| "collectionName": "Nerdcast", | |
| "trackName": "Nerdcast", | |
| "collectionCensoredName": "Nerdcast", | |
| "trackCensoredName": "Nerdcast", |
This file contains hidden or 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
| module.exports = { | |
| globals: { | |
| 'ts-jest': { | |
| enableTsDiagnostics: true, | |
| }, | |
| }, | |
| verbose: true, | |
| transform: { | |
| '^.+\\.tsx?$': 'ts-jest', | |
| }, |
This file contains hidden or 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
| { | |
| ... | |
| "scripts": { | |
| "test": "jest --config jest.config.js --ci --forceExit" | |
| ... | |
| }, | |
| ... | |
| } |
This file contains hidden or 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
| npm install jest ts-jest @types/jest request --save-dev |
This file contains hidden or 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
| bot.on('inline_query', ({ answerInlineQuery, inlineQuery }) => { | |
| const nome: string = inlineQuery.query; | |
| // Quantidade máxima de podcasts a serem pequisados para serem retornados por pesquisa. | |
| const limitePesquisa: number = 20; | |
| // Offset é a "página" que o usário se encontra no scroll das pequisas inline. | |
| const offset: number = parseInt(inlineQuery.offset, 10) || 0; | |
| const opcoes: object = { | |
| media: 'podcast', | |
| entity: 'podcast', | |
| limit: offset + limitePesquisa |
This file contains hidden or 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
| bot.command('search', ({ replyWithMarkdown, message }) => { | |
| // Irá remover o '/search' da pequisa e retornar apenas o nome da podcast. | |
| const nome: string = message.text.replace(/(\/\w+)\s*/, ''); | |
| // Parametros para a pesquisa na iTunes, aqui que você deve mudar caso queira fazer deste um bot de música ou de filmes. | |
| const opcoes: object = { | |
| media: 'podcast', | |
| entity: 'podcast', | |
| limit: 1 | |
| }; | |