{"size": 619, "ext": "js", "max_stars_repo_path": "src/web/routes/language.test.js", "max_stars_repo_name": "mikeSmith08/htbhf-applicant-web-ui", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/web/routes/language.test.js", "max_issues_repo_name": "mikeSmith08/htbhf-applicant-web-ui", "max_issues_repo_issues_event_min_datetime": "2019-01-10T15:56:48.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-01T08:13:00.000Z", "max_forks_repo_path": "src/web/routes/language.test.js", "max_forks_repo_name": "mikeSmith08/htbhf-applicant-web-ui", "max_forks_repo_forks_event_min_datetime": "2019-12-13T16:17:34.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-24T14:40:29.000Z"}
{"max_stars_count": null, "max_issues_count": 238, "max_forks_count": 4, "avg_line_length": 51.5833333333, "max_line_length": 141, "alphanum_fraction": 0.7059773829}
const test = require('tape')
const { getLanguageBase } = require('./language')

test('getLanguageBase', async (t) => {
  t.equal(getLanguageBase('en-GB'), 'en', 'should strip down to just en')
  t.equal(getLanguageBase('us-CA'), 'us', 'should strip down to just us')
  t.equal(getLanguageBase('cy'), 'cy', 'should remain as just cy')
  t.throws(getLanguageBase.bind(null, ''), /language provided in the request is blank/, 'A blank language should throw an error')
  t.throws(getLanguageBase.bind(null, undefined), /language provided in the request is blank/, 'An undefined language should throw an error')
  t.end()
})
