diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 456c715a..90b2df32 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,5 +37,6 @@ jobs: - run: flutter analyze - name: Run Unit Tests run: | + pip install -Ur requirements.txt flutter test --coverage coveralls \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..94f990c7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +# Python requirements for devops + +coverage==5.3 # Unit test coverage +coveralls==2.1.2 # Coveralls linking (for code coverage reporting) \ No newline at end of file diff --git a/test/api_test.dart b/test/api_test.dart index 5f24f897..1b5470b4 100644 --- a/test/api_test.dart +++ b/test/api_test.dart @@ -27,15 +27,29 @@ void main() { }); - test("Select Profile", () async { + // Run a set of tests for user profile functionality + group("Profile Tests", () async { + + test("Profile Name Check", () async { + bool result = false; + + result = await UserProfileDBManager().profileNameExists("doesnotexist"); + expect(result, equals(false)); + + result = await UserProfileDBManager().profileNameExists("testuser"); + expect(result, equals(true)); + }); + // Ensure that we can select a user profile - final prf = await UserProfileDBManager().getSelectedProfile(); + test("Select Profile", () async { + final prf = await UserProfileDBManager().getSelectedProfile(); - expect(prf, isNot(null)); + expect(prf, isNot(null)); - expect(prf?.username, equals("testuser")); - expect(prf?.password, equals("testpassword")); - expect(prf?.server, equals("http://localhost:12345")); + expect(prf?.username, equals("testuser")); + expect(prf?.password, equals("testpassword")); + expect(prf?.server, equals("http://localhost:12345")); + }); }); } \ No newline at end of file