Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

segakazzz / 課題4 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
segakazzz wants to merge 6 commits into master
base: master
Choose a base branch
Loading
from kadai4-segakazzz
Open

segakazzz / 課題4 #26

segakazzz wants to merge 6 commits into master from kadai4-segakazzz

Conversation

@segakazzz
Copy link

@segakazzz segakazzz commented Jul 29, 2020

課題4のPRです。
チェックをおねがいします。

【TRY】おみくじAPI

おみくじAPIを作ってみよう

  • JSON形式でおみくじの結果を返す
  • 正月(1/1-1/3)だけ大吉にする
  • ハンドラのテストを書いてみる

回答

実行方法

$ cd cmd
$ go build -o omkj main.go
$ ./omkj
Server is running with port 8080👍

上記実行後任意のブラウザでアクセスすると以下のような結果が帰ってくる

{
 "time": "2020-07-26T22:54:31.541464+09:00",
 "dice": 1,
 "result": "凶"
}

処理説明補足

  • 以前作成した[Try]おみくじプログラムを作ろうを応用しました。
  • テストパッケージをomikuji_testとして作成しました。(課題2は同じパッケージ内で行った)
  • テストでは勉強のため、一部のテストをStandard Library提供の関数をMockして実行しました。
$ cd omikuji
$ go test --cover --coverprofile=coverprofile.out 
Server is starting with port 8000 👍
PASS
coverage: 97.6% of statements
ok github.com/gopherdojo/dojo8/kadai4/segakazzz/omikuji 0.016s

感想

  • APIの作成自体はすんなり終わりましたが、テストコードの作成にかなり苦戦しました

@segakazzz segakazzz added the kadai4 課題4 label Jul 29, 2020
@segakazzz segakazzz changed the title (削除) 課題4 / segakazzz (削除ここまで) (追記) segakazzz / 課題4 (追記ここまで) Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

kadai4 課題4

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /