Skip to content

Commit

Permalink
this should have been committed earlier, no-verify
Browse files Browse the repository at this point in the history
  • Loading branch information
brekk committed Jan 22, 2024
1 parent 72604fe commit afabfa5
Show file tree
Hide file tree
Showing 15 changed files with 259 additions and 190 deletions.
31 changes: 31 additions & 0 deletions apps/docs/dr-generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,37 @@
"links": [],
"workspace": "doctor-general"
},
{
"slugName": "reader",
"package": "doctor-general",
"pageSummary": "",
"filename": "packages/doctor-general/reader.js",
"comments": [
{
"start": 6,
"end": 28,
"summary": "@name iterateOverWorkspacesAndReadFiles",
"links": [],
"fileGroup": "",
"addTo": "",
"structure": {
"name": "iterateOverWorkspacesAndReadFiles",
"future": true,
"example": "```js test=true\nimport { fork, resolve, parallel } from 'fluture'\n// drgen-import-above\nfork(done)(x => {\n expect(x).toEqual([])\n done()\n})(\n parallel(10)(\n iterateOverWorkspacesAndReadFiles(\n {\n searchGlob: '*',\n ignore: []\n },\n '..',\n resolve(['tools/'])\n )\n )\n)"
},
"keywords": [
"@example",
"@future",
"@name"
],
"filename": "packages/doctor-general/reader.js",
"package": "doctor-general"
}
],
"order": 0,
"links": [],
"workspace": "doctor-general"
},
{
"slugName": "text",
"package": "doctor-general",
Expand Down
1 change: 1 addition & 0 deletions apps/docs/pages/doctor-general/_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"comment": "comment",
"processor": "processor",
"reader": "reader",
"text": "text"
}
27 changes: 27 additions & 0 deletions apps/docs/pages/doctor-general/reader.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# reader



## iterateOverWorkspacesAndReadFiles

@name iterateOverWorkspacesAndReadFiles

### Usage
```js test=true
import { fork, resolve, parallel } from 'fluture'

fork(done)(x => {
expect(x).toEqual([])
done()
})(
parallel(10)(
iterateOverWorkspacesAndReadFiles(
{
searchGlob: '*',
ignore: []
},
'..',
resolve(['tools/'])
)
)
)
53 changes: 23 additions & 30 deletions packages/doctor-general/autotests/comment.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,47 @@ import {
getExample,
getPageSummary,
getImportsForTests,
hasExample,
hasExample
} from '../comment'

test('hasExample', () => {
expect(hasExample({ structure: { example: [`test=true`] } })).toBeTruthy()
expect(hasExample({structure: {example: [`test=true`]}})).toBeTruthy()
expect(hasExample({})).toBeFalsy()
expect(hasExample('zipzop')).toBeFalsy()
})

test('getImportsForTests', () => {
const file = {
comments: [
{
structure: {
curried: [
{ name: 'coolWithConfig', lines: ['test=true'] },
{ name: 'cool', lines: ['test=true'] },
],
},
},
{
structure: { name: 'otherFunc', example: ['test=true'] },
},
],
}

expect(getImportsForTests(file)).toEqual([
'otherFunc',
'coolWithConfig',
'cool',
])
const file = { comments: [
{
structure: { curried: [
{ name: 'coolWithConfig', lines: ['test=true'] },
{ name: 'cool', lines: ['test=true'] }
] }
},
{
structure: { name: 'otherFunc', example: ['test=true'] }
}
] }

expect(getImportsForTests(file)).toEqual(['otherFunc', 'coolWithConfig', 'cool'])
})

test('getPageSummary', () => {
const rawLines = [
' * @pageSummary Hey cool this is a multi-line',
' * description of stuff in the whole file',
' * @page testPageSummary',
' * @huh notSure',
' * @huh notSure'
]
expect(getPageSummary(rawLines, Infinity, 0)).toEqual([
expect(
getPageSummary(rawLines, Infinity, 0)
).toEqual([
'Hey cool this is a multi-line',
'description of stuff in the whole file',
])
expect(getPageSummary([' * hey', ' * there'], Infinity, 0)).toEqual([
'hey',
'there',
'description of stuff in the whole file'
])
expect(
getPageSummary([' * hey', ' * there'], Infinity, 0)
).toEqual(['hey', 'there'])
})

test('getExample', () => {
Expand Down
80 changes: 38 additions & 42 deletions packages/doctor-general/autotests/processor.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// This test automatically generated by doctor-general.
// Sourced from 'processor.js', edits to this file may be erased.
import { validate, interrogate, arity } from '../processor'
import {
validate,
interrogate,
arity
} from '../processor'

test('arity', () => {
expect(arity((a, b, c) => {})).toEqual(3)
expect(arity(function tertiary(a, b, c) {})).toEqual(3)
expect(arity((a,b,c) => {})).toEqual(3)
expect(arity(function tertiary(a,b,c) {})).toEqual(3)
expect(arity(a => b => c => c)).toEqual(1)
expect(arity('poo')).toEqual(-1)
})
Expand All @@ -28,7 +32,7 @@ test('interrogate', () => {
'process',
'renderer',
'postRender',
'postProcess',
'postProcess'
],
checked: {
optional: { postProcess: false },
Expand All @@ -37,9 +41,9 @@ test('interrogate', () => {
output: false,
postRender: false,
process: false,
renderer: false,
},
},
renderer: false
}
}
})
expect(interrogate(myCoolProcessor)).toEqual({
additionalFieldCheck: {},
Expand All @@ -54,18 +58,16 @@ test('interrogate', () => {
output: true,
postRender: true,
process: true,
renderer: true,
},
},
renderer: true
}
}
})
expect(
interrogate({
...myCoolProcessor,
postProcess: (a, b, c) => b,
})
).toEqual({
expect(interrogate({
...myCoolProcessor,
postProcess: (a, b, c) => b
})).toEqual({
additionalFieldCheck: { postProcess: true },
additionalFields: ['postProcess'],
additionalFields: [ 'postProcess' ],
meetsOptionalRequirements: true,
meetsRequirements: true,
incorrectFields: [],
Expand All @@ -76,16 +78,14 @@ test('interrogate', () => {
output: true,
postRender: true,
process: true,
renderer: true,
},
},
renderer: true
}
}
})
expect(
interrogate({
...myCoolProcessor,
unsupportedFunction: (a, b) => b,
})
).toEqual({
expect(interrogate({
...myCoolProcessor,
unsupportedFunction: (a, b) => b
})).toEqual({
additionalFieldCheck: { unsupportedFunction: false },
additionalFields: ['unsupportedFunction'],
meetsOptionalRequirements: false,
Expand All @@ -97,10 +97,10 @@ test('interrogate', () => {
output: true,
postRender: true,
process: true,
renderer: true,
},
renderer: true
}
},
incorrectFields: ['postProcess'],
incorrectFields: ['postProcess']
})
})

Expand All @@ -112,19 +112,15 @@ test('validate', () => {
postRender: (a, b) => b,
renderer: (a, b) => b,
}

expect(validate({})).toBeFalsy()
expect(validate(myCoolProcessor)).toBeTruthy()
expect(
validate({
...myCoolProcessor,
postProcess: (a, b, c) => b,
})
).toBeTruthy()
expect(
validate({
...myCoolProcessor,
unsupportedFunction: (a, b) => b,
})
).toBeFalsy()
expect(validate({
...myCoolProcessor,
postProcess: (a, b, c) => b
})).toBeTruthy()
expect(validate({
...myCoolProcessor,
unsupportedFunction: (a, b) => b
})).toBeFalsy()
})
24 changes: 24 additions & 0 deletions packages/doctor-general/autotests/reader.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This test automatically generated by doctor-general.
// Sourced from 'reader.js', edits to this file may be erased.
import {
iterateOverWorkspacesAndReadFiles
} from '../reader'

import { fork, resolve, parallel } from 'fluture'
test('iterateOverWorkspacesAndReadFiles', (done) => {
fork(done)(x => {
expect(x).toEqual([])
done()
})(
parallel(10)(

Check failure on line 13 in packages/doctor-general/autotests/reader.spec.js

View workflow job for this annotation

GitHub Actions / test

iterateOverWorkspacesAndReadFiles

TypeError: parallel() expects its second argument to be an Array of valid Futures. Actual: map (function(a0) { return fn.apply(this, arguments); }) (resolve (["tools/"])) :: Future at Object.<anonymous> (autotests/reader.spec.js:13:14)
iterateOverWorkspacesAndReadFiles(
{
searchGlob: '*',
ignore: []
},
'..',
resolve(['tools/'])
)
)
)
})
4 changes: 3 additions & 1 deletion packages/doctor-general/autotests/text.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// This test automatically generated by doctor-general.
// Sourced from 'text.js', edits to this file may be erased.
import { trimComment } from '../text'
import {
trimComment
} from '../text'

test('trimComment', () => {
expect(trimComment(' * zipzop')).toEqual('zipzop')
Expand Down
Loading

0 comments on commit afabfa5

Please sign in to comment.