Skip to content

Commit 174009b

Browse files
authored
test files
1 parent a0d566a commit 174009b

File tree

11 files changed

+64
-0
lines changed

11 files changed

+64
-0
lines changed

0x01-ES6_promise/tests/0-main.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import getResponseFromAPI from "./0-promise.js";
2+
3+
const response = getResponseFromAPI();
4+
console.log(response instanceof Promise);

0x01-ES6_promise/tests/1-main.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import getFullResponseFromAPI from './1-promise';
2+
3+
console.log(getFullResponseFromAPI(true));
4+
console.log(getFullResponseFromAPI(false));

0x01-ES6_promise/tests/100-main.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import asyncUploadUser from "./100-await";
2+
3+
const test = async () => {
4+
const value = await asyncUploadUser();
5+
console.log(value);
6+
};
7+
8+
test();

0x01-ES6_promise/tests/2-main.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import handleResponseFromAPI from "./2-then";
2+
3+
const promise = Promise.resolve();
4+
handleResponseFromAPI(promise);

0x01-ES6_promise/tests/3-main.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import handleProfileSignup from "./3-all";
2+
3+
handleProfileSignup();

0x01-ES6_promise/tests/4-main.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import signUpUser from "./4-user-promise";
2+
3+
console.log(signUpUser("Bob", "Dylan"));

0x01-ES6_promise/tests/5-main.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import uploadPhoto from './5-photo-reject';
2+
3+
console.log(uploadPhoto('guillaume.jpg'));

0x01-ES6_promise/tests/6-main.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import handleProfileSignup from './6-final-user';
2+
3+
console.log(handleProfileSignup("Bob", "Dylan", "bob_dylan.jpg"));

0x01-ES6_promise/tests/7-main.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import loadBalancer from "./7-load_balancer";
2+
3+
const ukSuccess = 'Downloading from UK is faster';
4+
const frSuccess = 'Downloading from FR is faster';
5+
6+
const promiseUK = new Promise(function(resolve, reject) {
7+
setTimeout(resolve, 100, ukSuccess);
8+
});
9+
10+
const promiseUKSlow = new Promise(function(resolve, reject) {
11+
setTimeout(resolve, 400, ukSuccess);
12+
});
13+
14+
const promiseFR = new Promise(function(resolve, reject) {
15+
setTimeout(resolve, 200, frSuccess);
16+
});
17+
18+
const test = async () => {
19+
console.log(await loadBalancer(promiseUK, promiseFR));
20+
console.log(await loadBalancer(promiseUKSlow, promiseFR));
21+
}
22+
23+
test();

0x01-ES6_promise/tests/8-main.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import divideFunction from './8-try';
2+
3+
console.log(divideFunction(10, 2));
4+
console.log(divideFunction(10, 0));

0x01-ES6_promise/tests/9-main.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import guardrail from './9-try';
2+
import divideFunction from './8-try';
3+
4+
console.log(guardrail(() => { return divideFunction(10, 2)}));
5+
console.log(guardrail(() => { return divideFunction(10, 0)}));

0 commit comments

Comments
 (0)