1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(test): Don't rely on row IDs after moving tables

Row ID's are not guaranteed to match those from the original peer table.

New checking method is equally strict since we already verify the number
of entries, and the SQL schema guarantees that entries are unique.
This commit is contained in:
Anthony Bilinski 2022-03-31 20:14:10 -07:00
parent 46ef31293c
commit dc46267833
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -71,11 +71,9 @@ void appendVerifyChatsQueries(QVector<RawDatabase::Query>& verifyQueries)
}});
struct Functor {
int index = 0;
const std::vector<QByteArray> chatIds{aPk.getByteArray(), bPk.getByteArray(), cPk.getByteArray()};
void operator()(const QVector<QVariant>& row) {
QVERIFY(row[0].toByteArray() == chatIds[index]);
++index;
QVERIFY(std::find(chatIds.begin(), chatIds.end(), row[0].toByteArray()) != chatIds.end());
}
};
@ -93,11 +91,9 @@ void appendVerifyAuthorsQueries(QVector<RawDatabase::Query>& verifyQueries)
}});
struct Functor {
int index = 0;
const std::vector<QByteArray> chatIds{selfPk.getByteArray(), aPk.getByteArray(), bPk.getByteArray()};
const std::vector<QByteArray> authorIds{selfPk.getByteArray(), aPk.getByteArray(), bPk.getByteArray()};
void operator()(const QVector<QVariant>& row) {
QVERIFY(row[0].toByteArray() == chatIds[index]);
++index;
QVERIFY(std::find(authorIds.begin(), authorIds.end(), row[0].toByteArray()) != authorIds.end());
}
};
@ -128,11 +124,9 @@ void appendVerifyAliasesQueries(QVector<RawDatabase::Query>& verifyQueries)
}});
struct Functor {
int index = 0;
const std::vector<QByteArray> names{selfName.toUtf8(), aName.toUtf8(), bName.toUtf8()};
void operator()(const QVector<QVariant>& row) {
QVERIFY(row[0].toByteArray() == names[index]);
++index;
QVERIFY(std::find(names.begin(), names.end(), row[0].toByteArray()) != names.end());
}
};