-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconversao.test.js
More file actions
29 lines (21 loc) · 773 Bytes
/
conversao.test.js
File metadata and controls
29 lines (21 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { convertToInt, convertToString, convertToBoolean } = require('./conversao');
test('converte a string "42" para o número inteiro 42', () => {
expect(convertToInt('42')).toBe(42);
});
test('converte a string "-10" para o número inteiro -10', () => {
expect(convertToInt('-10')).toBe(-10);
});
//
test('converte o número inteiro 123 para a string "123"', () => {
expect(convertToString(123)).toBe('123');
});
test('converte o número inteiro -5 para a string "-5"', () => {
expect(convertToString(-5)).toBe('-5');
});
//
test('converte o valor 0 para o booleano false', () => {
expect(convertToBoolean(0)).toBe(false);
});
test('converte a string "true" para o booleano true', () => {
expect(convertToBoolean('true')).toBe(true);
});