mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-28 17:54:16 +08:00
Improve tests [SCI-2741]
This commit is contained in:
parent
363c1e4a34
commit
ed7c88f94d
1 changed files with 27 additions and 2 deletions
|
@ -85,6 +85,16 @@ RSpec.describe 'Api::V1::InventoryListItemsController', type: :request do
|
||||||
expect { hash_body = json }.not_to raise_exception
|
expect { hash_body = json }.not_to raise_exception
|
||||||
expect(hash_body).to match({})
|
expect(hash_body).to match({})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'When invalid request, items from text column' do
|
||||||
|
get api_v1_team_inventory_column_list_items_path(
|
||||||
|
team_id: @teams.first.id,
|
||||||
|
inventory_id: @valid_inventory.id,
|
||||||
|
column_id: @text_column.id
|
||||||
|
), headers: @valid_headers
|
||||||
|
expect(response).to have_http_status(400)
|
||||||
|
expect(response.body).to be_empty
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET inventory_list_items, #show' do
|
describe 'GET inventory_list_items, #show' do
|
||||||
|
@ -110,8 +120,8 @@ RSpec.describe 'Api::V1::InventoryListItemsController', type: :request do
|
||||||
get api_v1_team_inventory_column_list_item_path(
|
get api_v1_team_inventory_column_list_item_path(
|
||||||
id: 999,
|
id: 999,
|
||||||
team_id: @teams.first.id,
|
team_id: @teams.first.id,
|
||||||
inventory_id: 123,
|
inventory_id: @teams.first.repositories.first.id,
|
||||||
column_id: 999
|
column_id: @list_column.id
|
||||||
), headers: @valid_headers
|
), headers: @valid_headers
|
||||||
expect(response).to have_http_status(404)
|
expect(response).to have_http_status(404)
|
||||||
expect { hash_body = json }.not_to raise_exception
|
expect { hash_body = json }.not_to raise_exception
|
||||||
|
@ -299,6 +309,21 @@ RSpec.describe 'Api::V1::InventoryListItemsController', type: :request do
|
||||||
expect { hash_body = json }.to_not raise_exception
|
expect { hash_body = json }.to_not raise_exception
|
||||||
expect(hash_body).to match({})
|
expect(hash_body).to match({})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'When invalid request, non existing item' do
|
||||||
|
hash_body = nil
|
||||||
|
invalid_request_body = @request_body.deep_dup
|
||||||
|
invalid_request_body[:id] = 999
|
||||||
|
put api_v1_team_inventory_column_list_item_path(
|
||||||
|
id: 999,
|
||||||
|
team_id: @teams.first.id,
|
||||||
|
inventory_id: @valid_inventory.id,
|
||||||
|
column_id: @list_column
|
||||||
|
), params: invalid_request_body.to_json, headers: @valid_headers
|
||||||
|
expect(response).to have_http_status(404)
|
||||||
|
expect { hash_body = json }.to_not raise_exception
|
||||||
|
expect(hash_body).to match({})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'DELETE inventory_columns, #destroy' do
|
describe 'DELETE inventory_columns, #destroy' do
|
||||||
|
|
Loading…
Reference in a new issue