This repository was archived by the owner on Mar 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +0
-44
lines changed
Expand file tree Collapse file tree 5 files changed +0
-44
lines changed Original file line number Diff line number Diff line change @@ -20,21 +20,6 @@ class MockFirebase : public FirebaseArduino {
2020 MOCK_CONST_METHOD2 (begin, void (const String& host, const String& auth));
2121};
2222
23-
24- class MockFirebaseRequest : public FirebaseRequest {
25- public:
26- MOCK_CONST_METHOD0 (name, const std::string&());
27- MOCK_CONST_METHOD0 (response, const std::string&());
28- MOCK_CONST_METHOD0 (error, const FirebaseError&());
29- };
30-
31- class MockFirebaseStream : public FirebaseStream {
32- public:
33- MOCK_METHOD0 (available, bool ());
34- MOCK_METHOD1 (read, Event(std::string& event));
35- MOCK_CONST_METHOD0 (error, const FirebaseError&());
36- };
37-
3823} // modem
3924} // firebase
4025#endif // TEST_MOCK_FIREBASE_H
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ using ::testing::_;
1616class GetCommandTest : public ::testing::Test {
1717 protected:
1818 void SetUp () override {
19- get_.reset (new MockFirebaseRequest ());
2019 }
2120
2221 void FeedCommand (const String& path) {
@@ -26,26 +25,20 @@ class GetCommandTest : public ::testing::Test {
2625 }
2726
2827 bool RunCommand (const FirebaseError& error) {
29- EXPECT_CALL (*get_, error ())
30- .WillRepeatedly (ReturnRef (error));
31-
3228 GetCommand getCmd (&fbase_);
3329 return getCmd.execute (" GET" , &in_, &out_);
3430 }
3531
3632 MockInputStream in_;
3733 MockOutputStream out_;
3834 MockFirebase fbase_;
39- std::unique_ptr<MockFirebaseRequest> get_;
4035};
4136
4237TEST_F (GetCommandTest, gets) {
4338 const String path (" /test/path" );
4439 FeedCommand (path);
4540
4641 const String value (" Test value" );
47- EXPECT_CALL (*get_, response ())
48- .WillOnce (ReturnRef (value));
4942
5043 EXPECT_CALL (out_, print (String (" +" )))
5144 .WillOnce (Return (1 ));
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ using ::testing::_;
1717class PushCommandTest : public ::testing::Test {
1818 protected:
1919 void SetUp () override {
20- push_.reset (new MockFirebaseRequest ());
2120 }
2221
2322 void FeedCommand (const String& path, const String& data) {
@@ -41,20 +40,13 @@ class PushCommandTest : public ::testing::Test {
4140 }
4241
4342 bool RunExpectingData (const String& data, const FirebaseError& error) {
44- EXPECT_CALL (*push_, error ())
45- .WillRepeatedly (ReturnRef (error));
46-
47- EXPECT_CALL (fbase_, pushPtr (_, EncodeForJson (data)))
48- .WillOnce (Return (ByMove (std::move (push_))));
49-
5043 PushCommand pushCmd (&fbase_);
5144 return pushCmd.execute (" PUSH" , &in_, &out_);
5245 }
5346
5447 MockInputStream in_;
5548 MockOutputStream out_;
5649 MockFirebase fbase_;
57- std::unique_ptr<MockFirebaseRequest> push_;
5850};
5951
6052TEST_F (PushCommandTest, sendsData) {
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ using ::testing::_;
1616class RemoveCommandTest : public ::testing::Test {
1717 protected:
1818 void SetUp () override {
19- remove_.reset (new MockFirebaseRequest ());
2019 }
2120
2221 void FeedCommand (const String& path) {
@@ -26,11 +25,6 @@ class RemoveCommandTest : public ::testing::Test {
2625 }
2726
2827 bool RunCommand (const FirebaseError& error) {
29- EXPECT_CALL (*remove_, error ())
30- .WillRepeatedly (ReturnRef (error));
31-
32- EXPECT_CALL (fbase_, removePtr (_))
33- .WillOnce (Return (ByMove (std::move (remove_))));
3428
3529 RemoveCommand command (&fbase_);
3630 return command.execute (" REMOVE" , &in_, &out_);
@@ -39,7 +33,6 @@ class RemoveCommandTest : public ::testing::Test {
3933 MockInputStream in_;
4034 MockOutputStream out_;
4135 MockFirebase fbase_;
42- std::unique_ptr<MockFirebaseRequest> remove_;
4336};
4437
4538TEST_F (RemoveCommandTest, success) {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ using ::testing::_;
1717class SetCommandTest : public ::testing::Test {
1818 protected:
1919 void SetUp () override {
20- set_.reset (new MockFirebaseRequest ());
2120 }
2221
2322 void FeedCommand (const String& path, const String& data) {
@@ -41,11 +40,6 @@ class SetCommandTest : public ::testing::Test {
4140 }
4241
4342 bool RunExpectingData (const String& data, const FirebaseError& error) {
44- EXPECT_CALL (*set_, error ())
45- .WillRepeatedly (ReturnRef (error));
46-
47- EXPECT_CALL (fbase_, setPtr (_, EncodeForJson (data)))
48- .WillOnce (Return (ByMove (std::move (set_))));
4943
5044 SetCommand setCmd (&fbase_);
5145 return setCmd.execute (" SET" , &in_, &out_);
@@ -54,7 +48,6 @@ class SetCommandTest : public ::testing::Test {
5448 MockInputStream in_;
5549 MockOutputStream out_;
5650 MockFirebase fbase_;
57- std::unique_ptr<MockFirebaseRequest> set_;
5851};
5952
6053TEST_F (SetCommandTest, sendsData) {
You can’t perform that action at this time.
0 commit comments