setup electron app with boilerplate
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
|
||||
# Test executable for AuthManager
|
||||
qt_add_executable(testauthmanager
|
||||
# Test files
|
||||
testauthmanager.cpp
|
||||
testauthmanager.h
|
||||
|
||||
# Source files needed for testing
|
||||
../src/authmanager.cpp
|
||||
../src/authmanager.h
|
||||
../src/networkmanager.cpp
|
||||
../src/networkmanager.h
|
||||
)
|
||||
|
||||
# Link Qt modules
|
||||
target_link_libraries(testauthmanager
|
||||
PRIVATE
|
||||
Qt6::Core
|
||||
Qt6::Network
|
||||
Qt6::Test
|
||||
)
|
||||
|
||||
# Include src directory for headers
|
||||
target_include_directories(testauthmanager PRIVATE ../src)
|
||||
|
||||
# Enable automoc for Q_OBJECT processing
|
||||
set_target_properties(testauthmanager PROPERTIES
|
||||
AUTOMOC ON
|
||||
)
|
||||
|
||||
# Register with CTest
|
||||
add_test(NAME testauthmanager COMMAND testauthmanager)
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "testauthmanager.h"
|
||||
#include <QSignalSpy>
|
||||
|
||||
TestAuthManager::TestAuthManager(QObject *parent) : QObject{parent}, m_authManager(new AuthManager(this))
|
||||
{
|
||||
}
|
||||
|
||||
void TestAuthManager::add()
|
||||
{
|
||||
}
|
||||
|
||||
// FIX: invalid test without access to emailed code
|
||||
void TestAuthManager::testSignIn()
|
||||
{
|
||||
QSignalSpy codeSent(m_authManager, &AuthManager::codeSentToEmail);
|
||||
m_authManager->requestSignInCode("[email protected]");
|
||||
QVERIFY(codeSent.wait(5000));
|
||||
QCOMPARE(codeSent.count(), 1);
|
||||
|
||||
QSignalSpy signedIn(m_authManager, &AuthManager::isSignedInChanged);
|
||||
m_authManager->signIn("0000");
|
||||
QVERIFY(signedIn.wait(5000));
|
||||
QCOMPARE(signedIn.count(), 1);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestAuthManager)
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef TESTAUTHMANAGER_H
|
||||
#define TESTAUTHMANAGER_H
|
||||
|
||||
#include "authmanager.h"
|
||||
#include <QObject>
|
||||
#include <QTest>
|
||||
|
||||
class TestAuthManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TestAuthManager(QObject *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void add();
|
||||
|
||||
void testSignIn();
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
AuthManager *m_authManager;
|
||||
};
|
||||
|
||||
#endif // TESTAUTHMANAGER_H
|
||||
Reference in New Issue
Block a user