status-go/api
Eng Zer Jun 83ad76637a
test: use `T.TempDir` to create temporary test directory (#2746)
This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-04-26 21:39:51 +01:00
..
multiformat Add spiff workflow cmd 2023-03-16 14:31:34 +00:00
.gitignore Fix some tests & upgrade contracts 2021-07-20 10:57:38 +02:00
app_state.go Clean api package (#1055) 2018-06-27 10:11:45 +02:00
app_state_test.go Clean api package (#1055) 2018-06-27 10:11:45 +02:00
backend.go upgrade ethereum 2022-10-26 09:39:30 +02:00
backend_test.go test: use `T.TempDir` to create temporary test directory (#2746) 2023-04-26 21:39:51 +01:00
defaults.go Set keystore dir & network id 2023-03-30 13:39:54 +01:00
geth_backend.go feat:support backup/sync ens name (#3415) 2023-04-26 23:37:18 +08:00
test_helpers.go test: use `T.TempDir` to create temporary test directory (#2746) 2023-04-26 21:39:51 +01:00
utils.go synchronize display name (#2989) 2022-12-29 14:16:19 +08:00
utils_test.go tests: updated due to updating old accounts as a part of migration process 2023-03-28 16:19:27 +02:00