You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Only in the `Domain` layer and in the `*_test.go` files can we throw `errors.Panic()`.
373
376
- **Infrastructure**
374
377
- `New*()`, `Open()`&`Close()`
375
378
- `session`
376
-
- `errors.New*()`&`errors.BubbleUp()`
379
+
- `errors.New[...]()`&`errors.BubbleUp()`
377
380
- **Application**
378
381
- `Run()`, `Handle()`&`On()`
379
-
- `errors.New*()`&`errors.BubbleUp()`
382
+
- `errors.New[...]()`&`errors.BubbleUp()`
380
383
- **Presentation**
381
384
- **Modules**
382
385
- `Start()`&`Stop()`
383
386
- `errors.BubbleUp()`
384
387
- **Services / Apps**
385
388
- `Init()`, `Up()`&`Down()`
386
389
- `log.[Wrap]()`
387
-
- `errors.New*()`&`errors.BubbleUp()`
390
+
- `errors.New[...]()`&`errors.BubbleUp()`
388
391
- In `Apps` we will handle `Bubble Errors`.
389
392
- **Main**
390
393
- `log.Fatal()`&`log.[Wrap]()`
@@ -399,6 +402,57 @@ It is a monolith where CRUD operations can be performed from different presentat
399
402
- **Blocks**
400
403
- `const`, `var`, &`type`
401
404
- We will group only those that are declared on a single line.
405
+
- **Tests**
406
+
- **Subject/System/State Under Test (SUT)**
407
+
- The `SUT` will only be explicitly defined within the "suite (in the `s.SUT` field)"in those tests that cover several entities, such as "handlers/consumers, use cases, roles...".
408
+
- When testing only "functions and/or methods", it is not necessary to define an explicit `SUT` within the "suite (in the `s.SUT` field)", since the name of the "test cases" will indicate which `SUT` that specific case belongs to.
409
+
- **Suite**
410
+
- `<SUT>TestSuite`
411
+
- The name of the `<SUT>` can be that of the package, function, or type.
412
+
- `<SUT>Suite`
413
+
- When shared to test different implementations of the same `interface`.
414
+
- **Cases**
415
+
- **Happy Path**
416
+
- `Test<Function/Method>()`
417
+
- `Test<Function/Method><With/Without>*()`
418
+
- **Corner Case**
419
+
- `Test<Function/Method><Err/Panic>*`
420
+
- The semantics of the message and/or the words used after `<Err/Panic>` should only come from the error that is checked in the "test case".
421
+
- We will only check forerrors originatingin the functionor method being tested.
422
+
- With "Generic[...] Functions".
423
+
- `Test<Function>*()`
424
+
- `Test<Function>*<With/Without>*()`
425
+
- `Test<Function>*<Err/Panic>*()`
426
+
- **Sentinel**
427
+
- They are used to "compare" already defined values against "hardcoded" values to ensure their integrity.
428
+
- **Exceptions**
429
+
- In the "errors" package, there may be exceptions in the names of the "test cases" to avoid confusion.
430
+
- **Mothers**
431
+
- **Subject Under Test (SUT)**
432
+
- The `SUT` always refers to the "value (subject)" used within the method, whether to return an instance or generate an error.
433
+
- **Factory**
434
+
- **Valid** (used in**"Happy paths"**)
435
+
- `<SUT>Valid*()`
436
+
- **Invalid** (used in**"Corner Cases"**)
437
+
- `<SUT>Invalid*()`
438
+
- When it is necessary to define parameters in the method we use `With` to describe them, but `With` is not necessary in methods with a single "...variadic parameter".
439
+
- `<SUT>ValidWith*()`
440
+
- `<SUT>InvalidWith*()`
441
+
- **Wrap**
442
+
- These methods are only used to avoid handling error comparisons in"test cases".
443
+
- `<SUT>New()`
444
+
- `<SUT>Copy()`
445
+
- `<SUT>Replace()`
446
+
- With the exception of `Invalid`, all other methods that generate an error must throw a `panic()` and should never be ignored using `_`.
447
+
- There will only be one `Mother (mother.go)` per package.
0 commit comments