VolantisDev / Launchpad

Step up your non-Steam game! Generate Steam-compatible .exe files to effortlessly launch any game through Steam with overlay support.
https://launchpad.games
MIT License
85 stars 3 forks source link

Add more AppBase tests #311

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 3 years ago

Add more AppBase tests

https://github.com/VolantisDev/Launchpad/blob/189611ba17baa915a301ae8c3d8b7b010f67289c/Lib/Shared/AppLib/App/AppBase.test.ahk#L42


class AppBaseTest extends TestBase {
    testVersion := "76.9.12"
    appConfigClass := "AppConfig"
    appStateClass := "AppState"
    requiresTestApp := true

    GetTestAppConfig() {
        testAppConfig := super.GetTestAppConfig()
        testAppConfig["version"] := this.testVersion
        testAppConfig["configClass"] := this.appConfigClass
        testAppConfig["stateClass"] := this.appStateClass
        return testAppConfig
    }

    Run() {
        success := true

        if (!this.TestAppVersion()) {
            success := false
        }

        if (!this.TestAppConfig()) {
            success := false
        }

        if (!this.TestAppState()) {
            success := false
        }

        if (!this.TestAppServices()) {
            success := false
        }

        if (!this.TestAppLogger()) {
            success := false
        }

        if (!this.TestAppDebugger()) {
            success := false
        }

        ; TODO: Add more AppBase tests
        return true
    }

    TestAppVersion() {
        success := true

        if (!this.AssertEquals("App version", this.testAppInstance.Version, this.testVersion)) {
            success := false
        }

        ; TODO: Test changing app version
        return success
    }

    TestAppConfig() {
        return this.AssertEquals("App config class", Type(this.testAppInstance.Config), this.appConfigClass)
    }

    TestAppState() {
        return this.AssertEquals("App state class", Type(this.testAppInstance.State), this.appStateClass)
    }

    TestAppServices() {
        success := true
        ; TODO: Test that Services is a valid service container
        return success
    }

    TestAppLogger() {
        success := true
        ; TODO: Test that a valid logger class exists under Logger
        return success

    }

    TestAppDebugger() {
        success := true
        ; TODO: Test that a valid debugger class exists under Debugger
        return success
    }
}

f20c148630fc007ad6bc6f92d116b4063ca41ddc