I am trying to figure out the state of IMAP to Gmail account.

```
var Imap = require('imap');
var imapConnection = new Imap({
username: '',
password: '',
host: "imap.gmail.com",
port: 993,
debug: console.log
});
function testemail(){
imapConnection.connect();
if(imapConnection.state == 'authenticated'){
console.log('yay authenticated')
}
else{
console.log('No success:'+imapConnection.state)
}
}

**Output display:**

No success:disconnected

․[connection] Connected to host

```

I am confused as why it says that it connected to host and when I print the state of IMAP, it says as "Disconnected" ?