-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1043 from griffithlab/test-improvements
Minor test improvements
- Loading branch information
Showing
12 changed files
with
72 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require "test_helper" | ||
|
||
class LinksControllerTest < ActionDispatch::IntegrationTest | ||
test "it should 404 rather than redirect when the entity isn't found" do | ||
get "/links/features/999999" | ||
assert_response :not_found | ||
end | ||
|
||
test 'it should 400 bad request when its an invalid link type' do | ||
get '/links/footures/9999' | ||
assert_response :bad_request | ||
end | ||
|
||
test 'gene, feature, factor permalinks work' do | ||
feature = features.first | ||
feature_path = "/features/#{feature.id}" | ||
check_redirect "/links/features/#{feature.id}", feature_path | ||
check_redirect "/links/id/FID#{feature.id}", feature_path | ||
|
||
gene = feature_genes.first | ||
gene_path = "/features/#{gene.feature.id}" | ||
check_redirect "/links/genes/#{gene.id}", gene_path | ||
check_redirect "/links/id/GID#{gene.id}", gene_path | ||
check_redirect "/links/entrez_id/#{gene.entrez_id}", gene_path | ||
check_redirect "/links/entrez_name/#{gene.name}", gene_path | ||
end | ||
|
||
test 'variant links work' do | ||
variant = variants(:v600e) | ||
variant_path = "/variants/#{variant.id}" | ||
|
||
check_redirect "/links/id/VID#{variant.id}", variant_path | ||
check_redirect "/links/allele_registry/#{variant.allele_registry_id}", variant_path | ||
check_redirect "/links/variants/#{variant.id}", variant_path | ||
end | ||
|
||
test 'redirect legacy frontend gene route to corresponding feature' do | ||
gene = feature_genes.first | ||
check_redirect "/genes/#{gene.id}", "/features/#{gene.feature.id}" | ||
end | ||
|
||
def check_redirect(input_path, output_path) | ||
get input_path | ||
assert_response :redirect | ||
redirect_url = URI.parse(@response['Location']).path | ||
assert_equal output_path, redirect_url | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
msi: | ||
ncit_id: NCIT123 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
braf: | ||
name: BRAF | ||
full_name: B-Raf proto-oncogene, serine/threonine kinase | ||
feature_instance: braf (Features::Gene) | ||
|
||
vhl: | ||
name: VHL | ||
full_name: von Hippel-Lindau tumor suppressor | ||
feature_instance: vhl (Features::Gene) | ||
|
||
msi: | ||
name: MSI | ||
full_name: Microsatellite Instability | ||
description: The description for the MSI factor | ||
feature_instance: msi (Features::Factor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters