-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(unification): adding specs list for the app (#18391)
* wip * wip * Adding required icons and strings for spec list * adding icons with some duplication * wip * fixing the colors and classes * removing the Icon from usage in the button and input * green => jade * wip * Fixes * wip * merge * fixing no projects state * Adding better spec pattern parsing * Adding routing for the runner * adding more tests * update tests * chore: lint * update types * types * chore: align vue-i18n version * update findSpecs * remove old spec * omit new properties returned from findSpecs * fix test * use different type Co-authored-by: Jessica Sachs <jess@jessicasachs.io> Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
- Loading branch information
1 parent
db3e7b3
commit 98a9c06
Showing
118 changed files
with
1,459 additions
and
273 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,152 @@ | ||
// @ts-nocheck | ||
// @ts-ignore | ||
import * as JustMyLuck from 'just-my-luck' | ||
import faker from 'faker' | ||
import { template, keys, reduce, templateSettings } from 'lodash' | ||
import combineProperties from 'combine-properties' | ||
|
||
templateSettings.interpolate = /{{([\s\S]+?)}}/g | ||
|
||
let jml | ||
const setupSeeds = () => { | ||
const seed = 2 | ||
|
||
faker.seed(seed) | ||
jml = new JustMyLuck(JustMyLuck.MersenneTwister(seed)) | ||
} | ||
|
||
setupSeeds() | ||
|
||
beforeEach(() => setupSeeds) | ||
|
||
/** | ||
* Component Naming Fixtures | ||
*/ | ||
export const modifiers = [ | ||
'Async', | ||
'Dynamic', | ||
'Static', | ||
'Virtual', | ||
'Lazy', | ||
] | ||
|
||
export const domainModels = [ | ||
'Person', | ||
'Product', | ||
'Spec', | ||
'Settings', | ||
'Account', | ||
'Login', | ||
'Logout', | ||
'Launchpad', | ||
'Wizard', | ||
] | ||
|
||
export const componentNames = [ | ||
'List', | ||
'Table', | ||
'Header', | ||
'Footer', | ||
'Button', | ||
'Cell', | ||
'Row', | ||
'Skeleton', | ||
'Loader', | ||
'Layout', | ||
] | ||
|
||
export const specPattern = ['.spec', '_spec'] | ||
|
||
export const fileExtension = ['.tsx', '.jsx', '.ts', '.js'] | ||
|
||
export const directories = { | ||
rootDedicated: template('tests'), | ||
rootSrc: template('src'), | ||
monorepo: template('packages/{{component}}/test'), | ||
jestRoot: template('__test__'), | ||
jestNestedLib: template('lib/{{component}}{{component2}}/__test__'), | ||
dedicatedNested: template('lib/{{component}}/test'), | ||
jestNested: template('src/{{component}}/__test__'), | ||
componentsNested: template('src/components/{{component}}'), | ||
componentsFlat: template('src/{{component}}'), | ||
viewsFlat: template('src/views'), | ||
frontendFlat: template('frontend'), | ||
frontendComponentsFlat: template('frontend/components'), | ||
} | ||
|
||
const nameTemplates = { | ||
// Business Logic Components | ||
longDomain: template(`{{prefix}}{{modifier}}{{domain}}{{component}}`), | ||
longDomain2: template(`{{prefix}}{{domain}}{{component}}{{component2}}`), | ||
|
||
// App Components | ||
page1: template(`{{domain}}Page`), | ||
layout: template(`{{domain}}Layout`), | ||
|
||
presentationalShort: template(`Base{{component}}`), | ||
presentationalLong: template(`Base{{component}}{{component2}}`), | ||
medium1: template(`{{prefix}}{{modifier}}{{component}}`), | ||
medium2: template(`{{prefix}}{{component}}{{component2}}`), | ||
short: template(`{{prefix}}{{component}}`), | ||
} | ||
|
||
const prefixes = ['I', 'V', 'Cy', null] | ||
|
||
export const componentNameGenerator = (options: { template: any, omit: any, overrides: any } = { template: nameTemplates.medium1, omit: [], overrides: {} }) => { | ||
const withoutValues = reduce(options.omit, (acc, v) => { | ||
acc[v] = null | ||
|
||
return acc | ||
}, {}) | ||
|
||
const components = jml.pickCombination(componentNames, 2) | ||
const defaultOptions = { | ||
modifier: jml.pick(modifiers), | ||
domain: jml.pick(domainModels), | ||
prefix: jml.pick(prefixes), | ||
component: components[0], | ||
component2: components[1], | ||
} | ||
|
||
return options.template({ | ||
...defaultOptions, | ||
...withoutValues, | ||
...options.overrides, | ||
}) | ||
} | ||
|
||
const allRandomComponents = combineProperties({ | ||
domain: domainModels, | ||
modifier: modifiers, | ||
prefix: prefixes, | ||
component: componentNames, | ||
component2: componentNames, | ||
fileExtension, | ||
specPattern, | ||
directory: keys(directories), | ||
}) | ||
|
||
export const randomComponents = (n = 200) => { | ||
return faker.random.arrayElements(allRandomComponents, n).map((d) => { | ||
const name = componentNameGenerator({ | ||
overrides: d, | ||
template: faker.random.objectElement(nameTemplates), | ||
}) | ||
|
||
const gitFileState = jml.pick(['modified', 'unmodified', 'added', 'deleted']) | ||
|
||
return { | ||
componentName: name, | ||
relativePath: directories[d.directory](d), | ||
specExtension: d.specPattern, | ||
fileExtension: d.fileExtension, | ||
name: `${name}${d.specPattern}${d.fileExtension}`, | ||
id: faker.datatype.uuid(), | ||
gitInfo: { | ||
comitter: gitFileState ? faker.internet.userName() : undefined, | ||
timeAgo: gitFileState ? faker.datatype.datetime() : undefined, | ||
fileState: gitFileState, | ||
}, | ||
} | ||
}, n) | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.