Add test for account-tag capability

This commit is contained in:
NuclearW
2020-08-03 14:34:16 -04:00
parent f5c3ea403d
commit cf5472644a
2 changed files with 18 additions and 0 deletions

View File

@@ -82,6 +82,23 @@ TEST_F(ClientTest, AccountNotify) {
EXPECT_THAT(m_pTestClient->vsLines, ElementsAre(msg.ToString()));
}
TEST_F(ClientTest, AccountTag) {
m_pTestSock->ReadLine(":server CAP * ACK :account-tag");
m_pTestClient->Reset();
CMessage msg(":nick!user@host PRIVMSG #channel :text");
CMessage extmsg("@account=account-name :nick!user@host PRIVMSG #channel :text");
EXPECT_FALSE(m_pTestClient->HasAccountTag());
m_pTestClient->PutClient(extmsg);
EXPECT_THAT(m_pTestClient->vsLines, ElementsAre(msg.ToString()));
m_pTestClient->SetAccountTag(true);
m_pTestClient->SetTagSupport("account", true);
EXPECT_TRUE(m_pTestClient->HasAccountTag());
m_pTestClient->PutClient(extmsg);
EXPECT_THAT(m_pTestClient->vsLines,
ElementsAre(msg.ToString(), extmsg.ToString()));
}
TEST_F(ClientTest, AwayNotify) {
CMessage msg(":nick!user@host AWAY :message");
EXPECT_FALSE(m_pTestClient->HasAwayNotify());

View File

@@ -36,6 +36,7 @@ class TestClient : public CClient {
}
void Reset() { vsLines.clear(); }
void SetAccountNotify(bool bEnabled) { m_bAccountNotify = bEnabled; }
void SetAccountTag(bool bEnabled) { m_bAccountTag = bEnabled; }
void SetAwayNotify(bool bEnabled) { m_bAwayNotify = bEnabled; }
void SetExtendedJoin(bool bEnabled) { m_bExtendedJoin = bEnabled; }
void SetNamesx(bool bEnabled) { m_bNamesx = bEnabled; }