add: story and some tests
This commit is contained in:
@@ -33,6 +33,36 @@ Generally conform to resource-oriented design describe in
|
||||
https://google.aip.dev/general. Read aip.md for a summary. All proto service
|
||||
methods should be annotated with google.api.http hints and path variables.
|
||||
|
||||
When writing tests, always split the error cases into a different test. For example:
|
||||
|
||||
```go
|
||||
func TestThing(t *testing.T) {
|
||||
for _, tc := range []struct{
|
||||
name string
|
||||
}{
|
||||
{"test1"},
|
||||
} {
|
||||
t.Run(tc.name, func() {
|
||||
got, err := Thing()
|
||||
if err != nil { t.Fatalf("Got err=%v; want nil", err)}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestThingErrors(t *testing.T) {
|
||||
for _, tc := range []struct{
|
||||
name string
|
||||
}{
|
||||
{"test1"},
|
||||
} {
|
||||
t.Run(tc.name, func() {
|
||||
_, err := Thing()
|
||||
if err == nil { t.Fatalf("Got nil err; want err")}
|
||||
// Test thing
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Frontend/Typescript
|
||||
|
||||
Do not alter package.json directly, instead, use the CLI tool `npm`.
|
||||
|
||||
Reference in New Issue
Block a user