Skip to content

Commit ca77f56

Browse files
author
Sebastian Eduardo Cristi Castillo
committed
Se agregan asincronicas
1 parent f9982e8 commit ca77f56

File tree

4 files changed

+39
-3995
lines changed

4 files changed

+39
-3995
lines changed

asincronicas.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const axios = require('axios');
2+
3+
describe("Prueba de funcion asincronica, directamente hacia el servicio", () => {
4+
it("Obtiene usuarios con un .then", () => {
5+
axios.get("https://jsonplaceholder.typicode.com/users")
6+
.then(response => {
7+
expect(response.data.length).toBeGreaterThanOrEqual(10);
8+
})
9+
.catch(error => {
10+
throw new Error(error);
11+
});
12+
});
13+
14+
it("Obtiene usuarios con un await", async () => {
15+
const result = await axios.get("https://jsonplaceholder.typicode.com/users");
16+
expect(result.data).not.toBeNull();
17+
});
18+
});

math_function.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ describe('Prueba la funcion para sumar', function() {
1313
expect(typeof sumar(1, 1)).toBe("number");
1414
});
1515

16-
// it("Deberia retornar un numero aunque se le pase un string", () => {//Prueba fallando!
17-
// expect(typeof sumar("1", "1")).toBe("number");
18-
// });
16+
it.skip("Deberia retornar un numero aunque se le pase un string", () => {//Prueba fallando!
17+
expect(typeof sumar("1", "1")).toBe("number");
18+
});
1919

2020
test('Funciona correctamente con decimales', () => {
2121
expect(sumar(0.2, 0.1)).toBeCloseTo(0.3, 5);

0 commit comments

Comments
 (0)