-
Notifications
You must be signed in to change notification settings - Fork 0
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 #319 from dictyBase/feat/geneid-test
Auto-generated Pull Request for feat/geneid-test
- Loading branch information
Showing
14 changed files
with
84 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
cover.out | ||
cover.out | ||
.aider* | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- use at least three letters variable names | ||
- use fmt.Sprintf for string concatenation |
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,10 @@ | ||
{ | ||
"name": "modware-import", | ||
"dependencies": [ | ||
{ | ||
"name": "golang", | ||
"source": "github.com/dictybase-docker/dagger-of-dcr/golang@aa46f8610edad8ecfb0776e4c9fe85a486da87eb" | ||
} | ||
], | ||
"engineVersion": "v0.11.9" | ||
} |
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 |
---|---|---|
|
@@ -52,6 +52,6 @@ require ( | |
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) | ||
|
||
go 1.21 | ||
go 1.22 | ||
|
||
toolchain go1.22.5 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,9 @@ import ( | |
) | ||
|
||
const ( | ||
filterGene = `FILTER 'DDB_G0287317' IN s.genes` | ||
filterGeneMore = `FILTER 'DDB_G098058933' IN s.genes` | ||
|
||
filterOne = `FILTER s.depositor == '[email protected]'` | ||
filterTwo = `FILTER s.depositor == '[email protected]' | ||
AND s.depositor == '[email protected]' | ||
|
@@ -92,6 +95,7 @@ func createTestStrainsWithIDs( | |
if err != nil { | ||
return ids, err | ||
} | ||
time.Sleep(100 * time.Millisecond) | ||
ids = append(ids, nps.StockID) | ||
start++ | ||
} | ||
|
@@ -116,6 +120,7 @@ func createTestStrains( | |
if err != nil { | ||
return err | ||
} | ||
time.Sleep(100 * time.Millisecond) | ||
start++ | ||
} | ||
return nil | ||
|
@@ -512,15 +517,15 @@ func TestListStrains(t *testing.T) { | |
testModelListSort(ls3, t) | ||
} | ||
|
||
func TestListStrainsByIds(t *testing.T) { | ||
func TestListStrainsByIDs(t *testing.T) { | ||
t.Parallel() | ||
assert, repo := setUp(t) | ||
defer tearDown(repo) | ||
// add 10 new test strains | ||
ids, err := createTestStrainsWithIDs(30, General, repo) | ||
assert.NoError(err, "expect no error from creating strains") | ||
// get first five results | ||
ls, err := repo.ListStrainsByIds(&stock.StockIdList{Id: ids}) | ||
ls, err := repo.ListStrainsByIDs(&stock.StockIdList{Id: ids}) | ||
assert.NoError(err, "expect no error in getting strains") | ||
assert.Len(ls, 30, "should match the provided limit number") | ||
for _, stock := range ls { | ||
|
@@ -554,7 +559,7 @@ func TestListStrainsByIds(t *testing.T) { | |
) | ||
pids, err := createTestStrainsWithParent(30, General, repo, pm.StockID) | ||
assert.NoError(err, "expect no error from creating strains") | ||
pls, err := repo.ListStrainsByIds(&stock.StockIdList{Id: pids}) | ||
pls, err := repo.ListStrainsByIDs(&stock.StockIdList{Id: pids}) | ||
assert.NoError(err, "expect no error in getting 30 stocks with parents") | ||
assert.Len(pls, 30, "should match the provided limit number") | ||
for _, stock := range pls { | ||
|
@@ -581,7 +586,7 @@ func TestListStrainsByIds(t *testing.T) { | |
) | ||
} | ||
// Non-existing ids | ||
els, err := repo.ListStrainsByIds( | ||
els, err := repo.ListStrainsByIDs( | ||
&stock.StockIdList{Id: []string{"DBN589343", "DBN48473232"}}, | ||
) | ||
assert.NoErrorf( | ||
|
@@ -909,6 +914,49 @@ func TestEditStrain(t *testing.T) { | |
) | ||
} | ||
|
||
func TestListStrainsWithGeneFilter(t *testing.T) { | ||
t.Parallel() | ||
assert, repo := setUp(t) | ||
defer tearDown(repo) | ||
// Create test strain with specific gene | ||
ns := newTestStrain("[email protected]", General) | ||
ns.Data.Attributes.Genes = []string{"DDB_G0287317", "DDB_G0287318"} | ||
_, err := repo.AddStrain(ns) | ||
assert.NoError(err, "expect no error from creating strain with genes") | ||
|
||
// Create additional strains without the specific gene | ||
err = createTestStrains(5, General, repo) | ||
assert.NoError(err, "expect no error from creating additional strains") | ||
|
||
// Test filtering by gene | ||
ls, err := repo.ListStrains(&stock.StockParameters{ | ||
Limit: 10, | ||
Filter: filterGene, | ||
}) | ||
assert.NoError(err, "expect no error in getting strains filtered by gene") | ||
assert.Len(ls, 1, "should find exactly one strain with the specific gene") | ||
assert.Contains( | ||
ls[0].Genes, | ||
"DDB_G0287317", | ||
"returned strain should contain the filtered gene", | ||
) | ||
ls2, err := repo.ListStrains(&stock.StockParameters{ | ||
Limit: 10, | ||
Filter: filterGeneMore, | ||
}) | ||
assert.NoError(err, "expect no error in getting strains filtered by gene") | ||
assert.Len( | ||
ls2, | ||
5, | ||
"should find exactly five strains with the specific gene", | ||
) | ||
assert.Contains( | ||
ls2[1].Genes, | ||
"DDB_G098058933", | ||
"returned strain should contain the filtered gene", | ||
) | ||
} | ||
|
||
func TestEditStrainWithParent(t *testing.T) { | ||
t.Parallel() | ||
assert, repo := setUp(t) | ||
|
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