From 2beb32e1b60baf762b96c56b9361ef4e132380f2 Mon Sep 17 00:00:00 2001 From: Leonel Sanches da Silva <53848829+leonelsanchesdasilva@users.noreply.github.com> Date: Fri, 18 Aug 2023 17:35:11 -0700 Subject: [PATCH] =?UTF-8?q?Um=20teste=20unit=C3=A1rio,=20para=20o=20diret?= =?UTF-8?q?=C3=B3rio=20n=C3=A3o=20ficar=20vazio.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- testes/nucleo-execucao.test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 testes/nucleo-execucao.test.ts diff --git a/testes/nucleo-execucao.test.ts b/testes/nucleo-execucao.test.ts new file mode 100644 index 0000000..42cadb6 --- /dev/null +++ b/testes/nucleo-execucao.test.ts @@ -0,0 +1,20 @@ +import * as sistemaArquivos from 'fs'; +import * as caminho from 'path'; +import {expect, jest, test} from '@jest/globals'; + +import { NucleoExecucao } from '../fontes/nucleo-execucao'; + +jest.mock('sistemaArquivos'); +jest.mock('path'); + +describe('Núcleo de execução', () => { + it('`executarCodigoComoArgumento`, trivial', async () => { + let retornoSaida: string = ''; + const funcaoDeRetorno = (saida: string) => retornoSaida = saida; + const nucleoExecucao = new NucleoExecucao(funcaoDeRetorno); + nucleoExecucao.configurarDialeto(); + await nucleoExecucao.executarCodigoComoArgumento('escreva("Olá mundo!")'); + + expect(retornoSaida).toBe('Olá mundo!'); + }); +}); \ No newline at end of file