status-desktop/test/libs/StatusGoQt/test_onboarding.cpp
Stefan d5afd6beac chore(CPP): Create new wallet accounts - POC UI
The UI is for demo purposes. Also architecture decisions are open for change

Closes: #6321
2022-08-02 15:30:08 +02:00

39 lines
1.1 KiB
C++

#include <StatusGo/Accounts/AccountsAPI.h>
#include <StatusGo/Metadata/api_response.h>
#include <StatusGo/Accounts/Accounts.h>
#include <Onboarding/Common/Constants.h>
#include <Onboarding/OnboardingController.h>
#include <IOTestHelpers.h>
#include <gtest/gtest.h>
namespace Accounts = Status::StatusGo::Accounts;
namespace fs = std::filesystem;
namespace Status::Testing {
TEST(OnboardingApi, TestOpenAccountsNoDataFails) {
AutoCleanTempTestDir fusedTestFolder{test_info_->name()};
auto response = Accounts::openAccounts(fusedTestFolder.tempFolder().c_str());
EXPECT_FALSE(response.containsError());
EXPECT_EQ(response.result.count(), 0);
}
TEST(OnboardingApi, TestOpenAccountsNoDataCreatesFiles) {
AutoCleanTempTestDir fusedTestFolder{test_info_->name()};
auto response = Accounts::openAccounts(fusedTestFolder.tempFolder().c_str());
EXPECT_FALSE(response.containsError());
int fileCount = 0;
for (const auto & file : fs::directory_iterator(fusedTestFolder.tempFolder()))
fileCount++;
EXPECT_GT(fileCount, 0);
}
}