Clever / wag

sWAGger - Web API Generator
Apache License 2.0
77 stars 6 forks source link

DynamoDB generated tests are invalid for enums #398

Closed taylor-sutton closed 1 year ago

taylor-sutton commented 3 years ago

Specifically, the Branch on this line: https://github.com/Clever/wag/blob/4f33b600b94ea95eae37973c05751494e64200b4/server/gendb/templatefuncs.go#L524 leaks into the test from this part of the template: https://github.com/Clever/wag/blob/2c9a45920cbf7b5124e085382bee0fd137bfd28f/server/gendb/tests.go.tmpl#L66

For example, for an enum named DeploymentV2StateSummary, the test contains a bit like this

        m := models.DeploymentV2{
            Application: "string1",
            CreatedAt:   mustTime("2018-03-11T15:04:01+07:00"),
            Environment: "string1",
            ID:          "string1",
            State:       models.BranchDeploying,
        }

when it's actually supposed to look like

        m := models.DeploymentV2{
            Application: "string1",
            CreatedAt:   mustTime("2018-03-11T15:04:01+07:00"),
            Environment: "string1",
            ID:          "string1",
            State:       models.DeploymentV2StateSummaryDeploying,
        }