Skip to content

Commit 6b23611

Browse files
committed
feat: add OnePiece.TestSupport package
1 parent 1e87b58 commit 6b23611

File tree

13 files changed

+217
-0
lines changed

13 files changed

+217
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
- [OnePiece.GracefulShutdown](./apps/one_piece_graceful_shutdown/README.md) Catches `SIGTERM` signal to gracefully stop
88
the system.
99
- [OnePiece.Result](./apps/one_piece_result/README.md) Handles ok-error tuple responses.
10+
- [OnePiece.TestSupport](./apps/one_piece_test_support/README.md) A Swiss Army Knife for the Testing.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
line_length: 120,
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
one_piece_commanded-*.tar
24+
25+
# Temporary files for e.g. tests
26+
/tmp
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## Unreleased
4+
5+
## v0.1.0 - 2023-04-28
6+
7+
- Initial release
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023-Present Straw Hat, LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# OnePiece.TestSupport
2+
3+
A Swiss Army Knife for the Testing.
4+
5+
## Documentation
6+
7+
### References
8+
9+
- [API Reference](api-reference.html)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"coverage_options": {
3+
"treat_no_relevant_lines_as_covered": true
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
defmodule OnePiece.TestSupport do
2+
@moduledoc """
3+
A Swiss Army Knife for the Testing.
4+
"""
5+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
if Code.ensure_loaded?(Mox) do
2+
Mox.defmock(OnePiece.TestSupport.Mox.Task, for: OnePiece.TestSupport.Task)
3+
4+
if Code.ensure_loaded?(OnePiece.Clock) do
5+
Mox.defmock(OnePiece.TestSupport.Mox.Clock, for: OnePiece.Clock)
6+
end
7+
8+
if Code.ensure_loaded?(OnePiece.Commanded.Id) do
9+
Mox.defmock(OnePiece.TestSupport.Mox.Commanded.Id, for: OnePiece.Commanded.Id)
10+
end
11+
12+
if Code.ensure_loaded?(Commanded.Application) do
13+
Mox.defmock(OnePiece.TestSupport.Mox.Commanded.Application, for: Commanded.Application)
14+
end
15+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
defmodule OnePiece.TestSupport.Task do
2+
@moduledoc """
3+
A Swiss Army Knife for `Task` around.
4+
"""
5+
6+
@callback async(func :: (() -> any())) :: Task.t()
7+
end

0 commit comments

Comments
 (0)