Oct 25, 2019 12:56
This peice of code? OK sure.
Oct 25, 2019 12:56
congrats, nice :)
Oct 25, 2019 12:54
it needs to be
return new Promise(async function(resolve, reject) { ...
Oct 25, 2019 12:54
ithe code is wrong.
Oct 25, 2019 12:51
I wouldn't assert in a before block
Oct 25, 2019 12:50
sorry I don't know how to format it
Oct 25, 2019 12:50
`
...
before(async function () {
return new Promise((resolve, reject) => {
await client.connect(async function (err) {
if(err) return reject(err);
try {

const db = await client.db(dbName);

result = await db.collection("jobs").findOne({
"name": jobName
});

client.close();
} catch(err){
return reject(err);
}
return resolve();
});
});
});
...
`
Oct 25, 2019 12:47
The final await
Oct 25, 2019 12:47
try returning the await in the before
Oct 25, 2019 12:47
the it will run before the before has finished an async function if the before is returned a resolved promise.
Oct 25, 2019 12:47
ok, you have the outer before seems to be working fine, so what's different about the inner before? Is client.connect resolving before the awaits inside the async callback that gets passed to it?
Oct 25, 2019 12:47
Personally I would just use the 'done' callback like this: before(function(done){ /* some awaiting async code, done(err) */ });
 

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
May 9, 2018 23:11
hi
May 9, 2018 15:59
how can i edit a pdf document easily for free on android?
May 9, 2018 15:54
@KamilSolecki what about nano in bash terminal?
May 9, 2018 15:47
people are highly unpredictable. this is what sociology is for.
May 9, 2018 15:46
i reckon there is more interconnected traits rather than just bimodal distribution and so on.
May 9, 2018 15:41
i just received an email from a company wanting an interview in 2014 though so its ok :)
May 9, 2018 15:41
jesus christ.. yesterday i sent my CV/resume to about 7 companies. i wrote under personal skills: detail oriented. i just noticed my DOB has month as 17.
May 9, 2018 15:11
no need 2 be sorry, im sorry i can sound standoffish
May 9, 2018 15:07
@AndrasDeak a bit bleak
May 9, 2018 15:06
@overexchange what do you mean? the arguments in a function is similar to array but different
May 9, 2018 15:05
seems like they were panicking over nothing but give it a few years..
May 9, 2018 15:01
@AndrasDeak how did SOPA and no net neutrality etc. work out in the usa?
May 9, 2018 14:58
ok :)
May 9, 2018 14:57
@DenysSéguret also, regarding gdpr, if you have already obtained users data such as name, age, address without an obvious opt in checkbox, you will need to ask them to opt in next time they visit, otherwise delete their data.
May 9, 2018 14:44
where is computer science on that graph :(
May 9, 2018 14:42
adblock for youtube
May 9, 2018 14:42
couldnt figure it out
May 9, 2018 14:41
can i get chrome extensions on android?
May 9, 2018 14:39
@MasterDarkNight 404
May 9, 2018 14:37
Yea i disabled auto capitalize. X
May 9, 2018 14:35
sorry im on mobile
May 9, 2018 14:34
12 steps gdpr pdf
May 9, 2018 14:30
are you over 18 ? [ ● ]
May 9, 2018 14:28
just by trying to loophole it through words like that
May 9, 2018 14:28
it is not possible to waive their rights if they are in the EU
May 9, 2018 14:27
@MadaraUchiha that wont work
May 9, 2018 14:26
what else?
May 9, 2018 14:26
and to delete it
May 9, 2018 14:26
ok, and also to allow user to download their data within 30 days on request
May 9, 2018 14:25
@DenysSéguret basically you need to implement unchecked checkboxes and clearly label what data you would be storing, right?
May 9, 2018 14:23
ok what is that about, dead code elim?
May 9, 2018 14:22
i dont understand the advantages of import over require()
May 9, 2018 14:16
i suppose you could make a condition to break the loop which would be whether arr[iteration] throws an error?
May 9, 2018 14:15
since .forEach uses .length internally
May 9, 2018 14:14
i see what you mean actually because you dont want to use .length even inside a Array.forEach loop
May 9, 2018 14:12
i wont repeat my english pseudocode though
May 9, 2018 14:12
im saying start from scratch