Repository navigation
Closed
Description
There seem to be 2 problems, not with the tests themselves but rather with the doctest library:
- Not correctly validating
/**
* Converts the value of an individual column
* @param {String} columnName The column that you want to convert
* @param {{name: String, type: String}[]} columns All of the columns
* @param {Object} records The map of string values
* @param {Array} skipTypes An array of types that should not be converted
* @return {object} Useless information
*
* @example
* convertColumn('age', [{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}], ['Paul', '33'], [])
* //=>
* 33
*
* @example
* convertColumn('age', [{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}], ['Paul', '33'], ['int4'])
* //=>
* "33"
*/
export const convertColumn = (columnName, columns, records, skipTypes) => {
let column = columns.find(x => x.name == columnName)
if(skipTypes.includes(column.type)) return noop(records[columnName])
else return convertCell(column.type, records[columnName])
}Change the "33" to 33 and it will still return true.
- Unable to parse file
/**
* Takes an array of columns and an object of string values then converts each string value
* to its mapped type
* @param {{name: String, type: String}[]} columns
* @param {Object} records
* @param {Object} options The map of various options that can be applied to the mapper
* @param {Array} options.skipTypes The array of types that should not be converted
*
* @example
* convertChangeData([{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}], {'Paul', '33'}, {})
* //=>
* { first_name: 'Paul', age: 33 }
*/
export const convertChangeData = (columns, records, options = {}) => {
let result = {}
let skipTypes = typeof options.skipTypes !== 'undefined' ? options.skipTypes : []
Object.entries(records).map(([key, value]) => {
result[key] = convertColumn(key, columns, records, skipTypes)
})
return result
}This @example is causing the library to break.
The concept of the library is awesome, so I think we should pitch in to improve it. Other likely improvements:
We should be able to add descriptions to the examples (if it fits the JSdoc spec)
/**
* @example Add an example description here
* convertCell('bool', 'true')
* //=>
* true
*/We should be able to add descriptions to the return values (if it fits the JSdoc spec)
/**
* @example
* convertCell('bool', 'true')
* //=> Add a return value description here
* true
*/Metadata
Metadata
Assignees
Labels
No labels
Activity
kiwicopple commentedon Nov 10, 2019
Will wait for response from developer as I'm not sure about the license - MainShayne233/js-doctest#1
kiwicopple commentedon Nov 10, 2019
Looks like it doesn't cope well with await's either. See in
packages/pg-admin-js:kiwicopple commentedon Jan 30, 2020
Closing this as it will be tracked in the doctest-js repo:
kiwicopple/doctest-js#1
Merge pull request #3 from supabase/master
Merge pull request #3 from supabase/master
Merge pull request #3 from goszczynskip/feat/mamba-assets
Test for Amplify supabase#3
empty project (supabase#3)
diag: bisect #3 - restore Message.Parts edit, keep card stubbed
fix(observability): address PR review feedback on hit rate cards
fix: use refer vs see #3
feat(storage): make version list mocks adapt to bucket policy
refactor(studio): derive notebook diff entries (#49109)