-
Notifications
You must be signed in to change notification settings - Fork 17
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 #133 from musoke/test-csv
Test and refactor csvtojson
- Loading branch information
Showing
10 changed files
with
79 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { expect, test } from '@jest/globals' | ||
|
||
// NOTE: these imports implicitly regenerate the JSON files that store the conversions. | ||
import { | ||
BOULDER_GRADE_TABLE, | ||
ROUTE_GRADE_TABLE, | ||
ICE_GRADE_TABLE, | ||
AID_GRADE_TABLE | ||
} from '../csvtojson' | ||
|
||
describe.each([ | ||
{ table: BOULDER_GRADE_TABLE }, | ||
{ table: ROUTE_GRADE_TABLE }, | ||
{ table: ICE_GRADE_TABLE }, | ||
{ table: AID_GRADE_TABLE } | ||
])('Grade tables are parsable', ({ table }) => { | ||
test('each table is an array', async () => { | ||
expect.hasAssertions() // double check that async tests run | ||
const TABLE = await table | ||
|
||
expect(TABLE).toBeInstanceOf(Array) | ||
|
||
expect(TABLE.length).toBeGreaterThan(1) | ||
}) | ||
|
||
test('each table has a numeric score in first row', async () => { | ||
expect.hasAssertions() // double check that async tests run | ||
const TABLE = await table | ||
|
||
expect(TABLE[1]).toMatchObject( | ||
{ score: expect.any(Number) } | ||
) | ||
}) | ||
}) |
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,4 +1,4 @@ | ||
Score,Aid | ||
score,aid | ||
0,A0 | ||
1,A0 | ||
2,A0 | ||
|
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 @@ | ||
[{"score":0,"v":"VB-","font":"1a","band":"unknown"},{"score":1,"v":"VB-","font":"1a","band":"unknown"},{"score":2,"v":"VB-","font":"1a+","band":"unknown"},{"score":3,"v":"VB-","font":"1a+","band":"unknown"},{"score":4,"v":"VB-","font":"1b","band":"unknown"},{"score":5,"v":"VB-","font":"1b","band":"unknown"},{"score":6,"v":"VB-","font":"1b+","band":"unknown"},{"score":7,"v":"VB-","font":"1b+","band":"unknown"},{"score":8,"v":"VB-","font":"1c","band":"unknown"},{"score":9,"v":"VB-","font":"1c","band":"unknown"},{"score":10,"v":"VB-","font":"1c+","band":"unknown"},{"score":11,"v":"VB-","font":"1c+","band":"unknown"},{"score":12,"v":"VB","font":"2a","band":"unknown"},{"score":13,"v":"VB","font":"2a","band":"unknown"},{"score":14,"v":"VB","font":"2a+","band":"unknown"},{"score":15,"v":"VB","font":"2a+","band":"unknown"},{"score":16,"v":"VB","font":"2b","band":"unknown"},{"score":17,"v":"VB","font":"2b","band":"unknown"},{"score":18,"v":"VB","font":"2b+","band":"unknown"},{"score":19,"v":"VB","font":"2b+","band":"unknown"},{"score":20,"v":"VB","font":"2c","band":"unknown"},{"score":21,"v":"VB","font":"2c","band":"unknown"},{"score":22,"v":"VB","font":"2c+","band":"unknown"},{"score":23,"v":"VB","font":"2c+","band":"unknown"},{"score":24,"v":"VB+","font":"3a","band":"unknown"},{"score":25,"v":"VB+","font":"3a","band":"unknown"},{"score":26,"v":"VB+","font":"3a+","band":"unknown"},{"score":27,"v":"VB+","font":"3a+","band":"unknown"},{"score":28,"v":"VB+","font":"3b","band":"unknown"},{"score":29,"v":"VB+","font":"3b","band":"unknown"},{"score":30,"v":"VB+","font":"3b+","band":"unknown"},{"score":31,"v":"VB+","font":"3b+","band":"unknown"},{"score":32,"v":"VB+","font":"3c","band":"unknown"},{"score":33,"v":"VB+","font":"3c","band":"unknown"},{"score":34,"v":"VB+","font":"3c+","band":"unknown"},{"score":35,"v":"VB+","font":"3c+","band":"unknown"},{"score":36,"v":"V0-","font":"4a","band":"unknown"},{"score":37,"v":"V0-","font":"4a","band":"unknown"},{"score":38,"v":"V0-","font":"4a+","band":"unknown"},{"score":39,"v":"V0-","font":"4a+","band":"unknown"},{"score":40,"v":"V0","font":"4b","band":"unknown"},{"score":41,"v":"V0","font":"4b","band":"unknown"},{"score":42,"v":"V0","font":"4b+","band":"unknown"},{"score":43,"v":"V0","font":"4b+","band":"unknown"},{"score":44,"v":"V0+","font":"4c","band":"unknown"},{"score":45,"v":"V0+","font":"4c","band":"unknown"},{"score":46,"v":"V0+","font":"4c+","band":"unknown"},{"score":47,"v":"V0+","font":"4c+","band":"unknown"},{"score":48,"v":"V1","font":"5a","band":"unknown"},{"score":49,"v":"V1","font":"5a","band":"unknown"},{"score":50,"v":"V1","font":"5a+","band":"unknown"},{"score":51,"v":"V1","font":"5a+","band":"unknown"},{"score":52,"v":"V1","font":"5b","band":"unknown"},{"score":53,"v":"V2","font":"5b","band":"unknown"},{"score":54,"v":"V2","font":"5b+","band":"unknown"},{"score":55,"v":"V2","font":"5b+","band":"unknown"},{"score":56,"v":"V2","font":"5c","band":"unknown"},{"score":57,"v":"V2","font":"5c","band":"unknown"},{"score":58,"v":"V3","font":"5c+","band":"unknown"},{"score":59,"v":"V3","font":"5c+","band":"unknown"},{"score":60,"v":"V3","font":"6a","band":"unknown"},{"score":61,"v":"V3","font":"6a","band":"unknown"},{"score":62,"v":"V3","font":"6a+","band":"unknown"},{"score":63,"v":"V4","font":"6a+","band":"unknown"},{"score":64,"v":"V4","font":"6b","band":"unknown"},{"score":65,"v":"V4","font":"6b","band":"unknown"},{"score":66,"v":"V4","font":"6b+","band":"unknown"},{"score":67,"v":"V4","font":"6b+","band":"unknown"},{"score":68,"v":"V5","font":"6c","band":"unknown"},{"score":69,"v":"V5","font":"6c","band":"unknown"},{"score":70,"v":"V5","font":"6c+","band":"unknown"},{"score":71,"v":"V6","font":"6c+","band":"unknown"},{"score":72,"v":"V6","font":"7a","band":"unknown"},{"score":73,"v":"V6","font":"7a","band":"unknown"},{"score":74,"v":"V7","font":"7a+","band":"unknown"},{"score":75,"v":"V7","font":"7a+","band":"unknown"},{"score":76,"v":"V7","font":"7b","band":"unknown"},{"score":77,"v":"V8","font":"7b","band":"unknown"},{"score":78,"v":"V8","font":"7b+","band":"unknown"},{"score":79,"v":"V8","font":"7b+","band":"unknown"},{"score":80,"v":"V9","font":"7c","band":"unknown"},{"score":81,"v":"V9","font":"7c","band":"unknown"},{"score":82,"v":"V10","font":"7c+","band":"unknown"},{"score":83,"v":"V10","font":"7c+","band":"unknown"},{"score":84,"v":"V11","font":"8a","band":"unknown"},{"score":85,"v":"V11","font":"8a","band":"unknown"},{"score":86,"v":"V12","font":"8a+","band":"unknown"},{"score":87,"v":"V12","font":"8a+","band":"unknown"},{"score":88,"v":"V13","font":"8b","band":"unknown"},{"score":89,"v":"V13","font":"8b","band":"unknown"},{"score":90,"v":"V14","font":"8b+","band":"unknown"},{"score":91,"v":"V14","font":"8b+","band":"unknown"},{"score":92,"v":"V15","font":"8c","band":"unknown"},{"score":93,"v":"V15","font":"8c","band":"unknown"},{"score":94,"v":"V16","font":"8c+","band":"unknown"},{"score":95,"v":"V16","font":"8c+","band":"unknown"},{"score":96,"v":"V17","font":"9a","band":"unknown"},{"score":97,"v":"V17","font":"9a","band":"unknown"},{"score":98,"v":"V18","font":"9a+","band":"unknown"},{"score":99,"v":"V18","font":"9a+","band":"unknown"},{"score":100,"v":"V19","font":"9b","band":"unknown"},{"score":101,"v":"V19","font":"9b","band":"unknown"},{"score":102,"v":"V20","font":"9b+","band":"unknown"},{"score":103,"v":"V20","font":"9b+","band":"unknown"},{"score":104,"v":"V21","font":"9c","band":"unknown"},{"score":105,"v":"V21","font":"9c","band":"unknown"},{"score":106,"v":"V22","font":"9c+","band":"unknown"},{"score":107,"v":"V22","font":"9c+","band":"unknown"}] | ||
[{"score":0,"v":"VB-","font":"1a"},{"score":1,"v":"VB-","font":"1a"},{"score":2,"v":"VB-","font":"1a+"},{"score":3,"v":"VB-","font":"1a+"},{"score":4,"v":"VB-","font":"1b"},{"score":5,"v":"VB-","font":"1b"},{"score":6,"v":"VB-","font":"1b+"},{"score":7,"v":"VB-","font":"1b+"},{"score":8,"v":"VB-","font":"1c"},{"score":9,"v":"VB-","font":"1c"},{"score":10,"v":"VB-","font":"1c+"},{"score":11,"v":"VB-","font":"1c+"},{"score":12,"v":"VB","font":"2a"},{"score":13,"v":"VB","font":"2a"},{"score":14,"v":"VB","font":"2a+"},{"score":15,"v":"VB","font":"2a+"},{"score":16,"v":"VB","font":"2b"},{"score":17,"v":"VB","font":"2b"},{"score":18,"v":"VB","font":"2b+"},{"score":19,"v":"VB","font":"2b+"},{"score":20,"v":"VB","font":"2c"},{"score":21,"v":"VB","font":"2c"},{"score":22,"v":"VB","font":"2c+"},{"score":23,"v":"VB","font":"2c+"},{"score":24,"v":"VB+","font":"3a"},{"score":25,"v":"VB+","font":"3a"},{"score":26,"v":"VB+","font":"3a+"},{"score":27,"v":"VB+","font":"3a+"},{"score":28,"v":"VB+","font":"3b"},{"score":29,"v":"VB+","font":"3b"},{"score":30,"v":"VB+","font":"3b+"},{"score":31,"v":"VB+","font":"3b+"},{"score":32,"v":"VB+","font":"3c"},{"score":33,"v":"VB+","font":"3c"},{"score":34,"v":"VB+","font":"3c+"},{"score":35,"v":"VB+","font":"3c+"},{"score":36,"v":"V0-","font":"4a"},{"score":37,"v":"V0-","font":"4a"},{"score":38,"v":"V0-","font":"4a+"},{"score":39,"v":"V0-","font":"4a+"},{"score":40,"v":"V0","font":"4b"},{"score":41,"v":"V0","font":"4b"},{"score":42,"v":"V0","font":"4b+"},{"score":43,"v":"V0","font":"4b+"},{"score":44,"v":"V0+","font":"4c"},{"score":45,"v":"V0+","font":"4c"},{"score":46,"v":"V0+","font":"4c+"},{"score":47,"v":"V0+","font":"4c+"},{"score":48,"v":"V1","font":"5a"},{"score":49,"v":"V1","font":"5a"},{"score":50,"v":"V1","font":"5a+"},{"score":51,"v":"V1","font":"5a+"},{"score":52,"v":"V1","font":"5b"},{"score":53,"v":"V2","font":"5b"},{"score":54,"v":"V2","font":"5b+"},{"score":55,"v":"V2","font":"5b+"},{"score":56,"v":"V2","font":"5c"},{"score":57,"v":"V2","font":"5c"},{"score":58,"v":"V3","font":"5c+"},{"score":59,"v":"V3","font":"5c+"},{"score":60,"v":"V3","font":"6a"},{"score":61,"v":"V3","font":"6a"},{"score":62,"v":"V3","font":"6a+"},{"score":63,"v":"V4","font":"6a+"},{"score":64,"v":"V4","font":"6b"},{"score":65,"v":"V4","font":"6b"},{"score":66,"v":"V4","font":"6b+"},{"score":67,"v":"V4","font":"6b+"},{"score":68,"v":"V5","font":"6c"},{"score":69,"v":"V5","font":"6c"},{"score":70,"v":"V5","font":"6c+"},{"score":71,"v":"V6","font":"6c+"},{"score":72,"v":"V6","font":"7a"},{"score":73,"v":"V6","font":"7a"},{"score":74,"v":"V7","font":"7a+"},{"score":75,"v":"V7","font":"7a+"},{"score":76,"v":"V7","font":"7b"},{"score":77,"v":"V8","font":"7b"},{"score":78,"v":"V8","font":"7b+"},{"score":79,"v":"V8","font":"7b+"},{"score":80,"v":"V9","font":"7c"},{"score":81,"v":"V9","font":"7c"},{"score":82,"v":"V10","font":"7c+"},{"score":83,"v":"V10","font":"7c+"},{"score":84,"v":"V11","font":"8a"},{"score":85,"v":"V11","font":"8a"},{"score":86,"v":"V12","font":"8a+"},{"score":87,"v":"V12","font":"8a+"},{"score":88,"v":"V13","font":"8b"},{"score":89,"v":"V13","font":"8b"},{"score":90,"v":"V14","font":"8b+"},{"score":91,"v":"V14","font":"8b+"},{"score":92,"v":"V15","font":"8c"},{"score":93,"v":"V15","font":"8c"},{"score":94,"v":"V16","font":"8c+"},{"score":95,"v":"V16","font":"8c+"},{"score":96,"v":"V17","font":"9a"},{"score":97,"v":"V17","font":"9a"},{"score":98,"v":"V18","font":"9a+"},{"score":99,"v":"V18","font":"9a+"},{"score":100,"v":"V19","font":"9b"},{"score":101,"v":"V19","font":"9b"},{"score":102,"v":"V20","font":"9b+"},{"score":103,"v":"V20","font":"9b+"},{"score":104,"v":"V21","font":"9c"},{"score":105,"v":"V21","font":"9c"},{"score":106,"v":"V22","font":"9c+"},{"score":107,"v":"V22","font":"9c+"}] |
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,4 +1,4 @@ | ||
Score,WI,AI | ||
score,wi,ai | ||
0,WI1,AI1 | ||
1,WI1,AI1 | ||
2,WI1,AI1 | ||
|
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
Oops, something went wrong.