質問編集履歴
1
不要な記載を削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -48,23 +48,17 @@
|
|
48
48
|
const assert = chai.assert
|
49
49
|
import { readJsonFile } from '../../lib/file_utils'
|
50
50
|
import { apiGetRequest } from '../../lib/request_utils'
|
51
|
-
import { BASE_URL } from '../../lib/constants'
|
52
51
|
import { insertData, destroy, setup } from '../../lib/db'
|
53
52
|
|
54
|
-
const URL = BASE_URL + '/v1/sample/'
|
55
|
-
|
56
53
|
describe('test', function() {
|
57
|
-
// マスターデータ以外を削除
|
58
54
|
before(async () => {
|
59
55
|
await destroy()
|
60
56
|
})
|
61
57
|
|
62
|
-
// スーパーユーザー挿入
|
63
58
|
beforeEach(async () => {
|
64
59
|
await setup()
|
65
60
|
})
|
66
61
|
|
67
|
-
// マスターデータ以外を削除
|
68
62
|
afterEach(async () => {
|
69
63
|
await destroy()
|
70
64
|
})
|
@@ -73,17 +67,11 @@
|
|
73
67
|
// データ挿入
|
74
68
|
await insertData('sample/detail/0001.sql')
|
75
69
|
|
76
|
-
const id = 1 // 対象ID
|
77
|
-
const uri =
|
70
|
+
const uri = BASE_URL + 1
|
78
71
|
|
79
72
|
// リクエスト実行
|
80
73
|
const response = await apiGetRequest(uri)
|
81
|
-
const body = JSON.parse(response.body)
|
82
|
-
const expectJson = await readJsonFile('sample/detail/0001_response.json')
|
83
|
-
|
84
|
-
assert.strictEqual(
|
74
|
+
assert.strictEqual(response.statusCode, 200)
|
85
|
-
// レスポンスボディの比較
|
86
|
-
assert.strictEqual(JSON.stringify(body), JSON.stringify(expectJson))
|
87
75
|
})
|
88
76
|
})
|
89
77
|
```
|