├── .eslintrc.js ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── deploy-gh-pages.yml │ └── lint-and-test.yml ├── .gitignore ├── .npmignore ├── .vscode └── tasks.json ├── LICENSE ├── README.md ├── clean.js ├── execShellCommand.js ├── package-lock.json ├── package.json ├── src ├── decorators.ts ├── fast-fuzz.ts ├── fuzz │ ├── fuzz.ts │ ├── fuzzAsync.ts │ ├── fuzzCaller.ts │ ├── fuzzRunner.ts │ ├── fuzzSync.ts │ ├── fuzzWorker.ts │ ├── result.ts │ ├── util.ts │ └── worker.ts ├── generators │ ├── Generator.ts │ ├── GeneratorArg.ts │ ├── GeneratorBool.ts │ ├── GeneratorDate.ts │ ├── GeneratorEnum.ts │ ├── GeneratorFactory.ts │ ├── GeneratorFalsy.ts │ ├── GeneratorFloat.ts │ ├── GeneratorInt.ts │ ├── GeneratorString.ts │ ├── GeneratorType.ts │ ├── IGenerator.ts │ └── Mode.ts ├── index.ts ├── intermock │ ├── LICENSE │ └── build │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── index.js.map │ │ ├── src │ │ ├── cli │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.js.map │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── index.js.map │ │ ├── lang │ │ │ └── ts │ │ │ │ ├── intermock.d.ts │ │ │ │ ├── intermock.js │ │ │ │ └── intermock.js.map │ │ └── lib │ │ │ ├── constants.d.ts │ │ │ ├── constants.js │ │ │ ├── constants.js.map │ │ │ ├── default-type-to-mock.d.ts │ │ │ ├── default-type-to-mock.js │ │ │ ├── default-type-to-mock.js.map │ │ │ ├── fake.d.ts │ │ │ ├── fake.js │ │ │ ├── fake.js.map │ │ │ ├── fixed-data.d.ts │ │ │ ├── fixed-data.js │ │ │ ├── fixed-data.js.map │ │ │ ├── generate-fixed-data.d.ts │ │ │ ├── generate-fixed-data.js │ │ │ ├── generate-fixed-data.js.map │ │ │ ├── generators.d.ts │ │ │ ├── generators.js │ │ │ ├── generators.js.map │ │ │ ├── random-range.d.ts │ │ │ ├── random-range.js │ │ │ ├── random-range.js.map │ │ │ ├── read-files.d.ts │ │ │ ├── read-files.js │ │ │ ├── read-files.js.map │ │ │ ├── smart-props.d.ts │ │ │ ├── smart-props.js │ │ │ ├── smart-props.js.map │ │ │ ├── stringify.d.ts │ │ │ ├── stringify.js │ │ │ └── stringify.js.map │ │ └── test │ │ └── ts │ │ ├── mock.spec.d.ts │ │ ├── mock.spec.js │ │ ├── mock.spec.js.map │ │ ├── stringify.spec.d.ts │ │ ├── stringify.spec.js │ │ ├── stringify.spec.js.map │ │ └── test-data │ │ ├── any.d.ts │ │ ├── any.js │ │ ├── any.js.map │ │ ├── array.d.ts │ │ ├── array.js │ │ ├── array.js.map │ │ ├── enum.d.ts │ │ ├── enum.js │ │ ├── enum.js.map │ │ ├── extension.d.ts │ │ ├── extension.js │ │ ├── extension.js.map │ │ ├── flat.d.ts │ │ ├── flat.js │ │ ├── flat.js.map │ │ ├── functions.d.ts │ │ ├── functions.js │ │ ├── functions.js.map │ │ ├── generic.d.ts │ │ ├── generic.js │ │ ├── generic.js.map │ │ ├── json.d.ts │ │ ├── json.js │ │ ├── json.js.map │ │ ├── mappedTypes.d.ts │ │ ├── mappedTypes.js │ │ ├── mappedTypes.js.map │ │ ├── mockType.d.ts │ │ ├── mockType.js │ │ ├── mockType.js.map │ │ ├── namespace.d.ts │ │ ├── namespace.js │ │ ├── namespace.js.map │ │ ├── nestedSingle.d.ts │ │ ├── nestedSingle.js │ │ ├── nestedSingle.js.map │ │ ├── optional.d.ts │ │ ├── optional.js │ │ ├── optional.js.map │ │ ├── specificInterfaces.d.ts │ │ ├── specificInterfaces.js │ │ ├── specificInterfaces.js.map │ │ ├── tuple.d.ts │ │ ├── tuple.js │ │ ├── tuple.js.map │ │ ├── typeAlias.d.ts │ │ ├── typeAlias.js │ │ ├── typeAlias.js.map │ │ ├── unions.d.ts │ │ ├── unions.js │ │ └── unions.js.map ├── tsconfig.app.json └── utils │ ├── code.ts │ ├── decorators.ts │ ├── globals.ts │ ├── limits.ts │ └── modules.ts ├── test ├── builtinsArray.test.ts ├── builtinsDefault.test.ts ├── builtinsLimit.test.ts ├── enumArray.test.ts ├── enumDict.test.ts ├── enumNum.test.ts ├── guidedInstance.test.ts ├── guidedStatic.test.ts ├── naked.test.ts ├── regularInstance.test.ts ├── regularStatic.test.ts ├── simpleInstance.test.ts ├── simpleStatic.test.ts ├── skip.test.ts ├── sut │ ├── builtinsArray.ts │ ├── builtinsDefault.ts │ ├── builtinsLimit.ts │ ├── enumDict.ts │ ├── enumNum.ts │ ├── enumNumArray.ts │ ├── guidedInstance.ts │ ├── guidedStatic.ts │ ├── naked.ts │ ├── regularInstance.ts │ ├── regularStatic.ts │ ├── simpleInstance.ts │ ├── simpleStatic.ts │ ├── skip.ts │ ├── typeInherit.ts │ ├── typeInstance.ts │ ├── typeReference.ts │ ├── typeSingle.ts │ └── typeStuff.ts ├── testRunner.ts ├── typeInherit.test.ts ├── typeSingle.test.ts └── typeStuff.test.ts ├── tplant-3.1.2.tgz └── tsconfig.json /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: '@typescript-eslint/parser', 4 | 5 | plugins: [ 6 | '@typescript-eslint', 7 | ], 8 | 9 | extends: [ 10 | 'eslint:recommended', 11 | 'plugin:@typescript-eslint/recommended', 12 | ], 13 | 14 | env: { 15 | node: true 16 | }, 17 | 18 | 'extends': [ 19 | 'eslint:recommended', 20 | 'plugin:@typescript-eslint/recommended' 21 | ], 22 | 23 | parserOptions: { 24 | ecmaVersion: 2020 25 | }, 26 | "ignorePatterns": [ 27 | "dist/*", 28 | "*.test.js", 29 | ".eslintrc.js", 30 | "execShellCommand.js", 31 | "postinstall.js", 32 | "publish.js" 33 | ], 34 | rules: { 35 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 36 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 37 | '@typescript-eslint/no-this-alias': [ 38 | "error", 39 | { 40 | "allowDestructuring": false, // Disallow `const { props, state } = this`; true by default 41 | "allowedNames": ["self"] // Allow `const self = this`; `[]` by default 42 | } 43 | ], 44 | '@typescript-eslint/no-var-requires': 0 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Expected Behavior 2 | 3 | 4 | ## Actual Behavior 5 | 6 | 7 | ## Steps to Reproduce the Problem 8 | 9 | 1. 10 | 1. 11 | 1. 12 | 13 | ## Specifications 14 | 15 | - Version: 16 | - Platform: 17 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Fixes # 2 | 3 | > It's a good idea to open an issue first for discussion. 4 | 5 | - [ ] Tests pass 6 | - [ ] Appropriate changes to README are included in PR 7 | -------------------------------------------------------------------------------- /.github/workflows/deploy-gh-pages.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Builds the docs and deploys to GitHub pages 3 | # 4 | # https://github.com/actions/setup-node 5 | # Using https://github.com/marketplace/actions/deploy-to-github-pages 6 | name: Deploy to Github pages 7 | 8 | on: 9 | push: 10 | #tags: 11 | # - v* 12 | branches: 13 | - master 14 | 15 | jobs: 16 | deploy_pages: 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v2 21 | - uses: actions/setup-node@v2-beta 22 | with: 23 | node-version: '12' 24 | - run: yarn install 25 | - run: yarn docs 26 | 27 | - run: touch docs/.nojekyll 28 | - name: Deploy docs 🚀 29 | uses: JamesIves/github-pages-deploy-action@releases/v3 30 | with: 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | BRANCH: gh-pages # The branch the action should deploy to. 33 | FOLDER: docs # The folder the action should deploy. 34 | -------------------------------------------------------------------------------- /.github/workflows/lint-and-test.yml: -------------------------------------------------------------------------------- 1 | name: Lint and test 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | lint_and_test: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | nodejs: [16, 18, 20] 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | # https://github.com/actions/setup-node 17 | - uses: actions/setup-node@v2-beta 18 | with: 19 | node-version: ${{ matrix.nodejs }} 20 | 21 | - run: npm install 22 | # - run: npm run lint 23 | - run: npm test 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .npmrc 2 | node_modules/ 3 | /build/ 4 | /lib/ 5 | /dist/ 6 | /docs/ 7 | .idea/* 8 | 9 | .DS_Store 10 | coverage 11 | *.log 12 | *fuzzInstances.json 13 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /.github/ 2 | /.vscode/ 3 | /node_modules/ 4 | /build/ 5 | /tmp/ 6 | .idea/* 7 | /docs/ 8 | 9 | coverage 10 | *.log 11 | .gitlab-ci.yml 12 | 13 | package-lock.json 14 | /*.tgz 15 | /tmp* 16 | /mnt/ 17 | /package/ 18 | 19 | *fuzzInstances.json 20 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "npm", 6 | "script": "build-all", 7 | "group": "build", 8 | "problemMatcher": [], 9 | "label": "npm: build-all", 10 | "detail": "npm run clean && npm run build" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2022 We Watch Wall Inc. 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 8 | -------------------------------------------------------------------------------- /clean.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | function deleteFolderRecursive(path) { 4 | if (fs.existsSync(path) && fs.lstatSync(path).isDirectory()) { 5 | fs.readdirSync(path).forEach(function(file){ 6 | var curPath = path + "/" + file; 7 | 8 | if (fs.lstatSync(curPath).isDirectory()) { // recurse 9 | deleteFolderRecursive(curPath); 10 | } else { // delete file 11 | fs.unlinkSync(curPath); 12 | } 13 | }); 14 | 15 | console.log(`Deleting directory "${path}"...`); 16 | fs.rmdirSync(path); 17 | } 18 | } 19 | 20 | // print process.argv 21 | process.argv.forEach(function (val, index) { 22 | if (index > 1) { 23 | deleteFolderRecursive(val); 24 | } 25 | }); -------------------------------------------------------------------------------- /execShellCommand.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Executes a shell command and return it as a Promise. 3 | * @param cmd {string} 4 | * @return {Promise} 5 | */ 6 | function execShellCommand(cmd) { 7 | const exec = require('child_process').exec; 8 | return new Promise((resolve, reject) => { 9 | exec(cmd, (error, stdout, stderr) => { 10 | if (error) { 11 | console.warn(error); 12 | reject(error); 13 | } 14 | resolve(stdout? stdout : stderr); 15 | }); 16 | }); 17 | } 18 | 19 | module.exports = execShellCommand; 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fast-fuzz", 3 | "version": "5.1.7", 4 | "description": "Test case fuzzer with branch coverage guidance.", 5 | "main": "./dist/src/fast-fuzz.js", 6 | "types": "./dist/src/fast-fuzz.d.ts", 7 | "bin": { 8 | "fast-fuzz": "./dist/src/index.js" 9 | }, 10 | "scripts": { 11 | "clean": "node clean.js dist build package", 12 | "lint": "eslint ./ --ext .js,.jsx,.ts,.tsx", 13 | "lint:fix": "eslint ./ --ext .js,.jsx,.ts,.tsx --fix", 14 | "build": "tsc", 15 | "build-all": "npm run clean && npm run build", 16 | "prepare": "npm run build", 17 | "test": "ts-mocha test/**/*.test.ts" 18 | }, 19 | "keywords": [ 20 | "testing", 21 | "white-box", 22 | "unit-testing", 23 | "typescript", 24 | "fuzzing", 25 | "generative-testing", 26 | "verification" 27 | ], 28 | "author": "Adrian Burlacu ", 29 | "license": "ISC", 30 | "repository": { 31 | "type": "git", 32 | "url": "https://github.com/WeWatchWall/fast-fuzz.git" 33 | }, 34 | "devDependencies": { 35 | "@types/chai": "^4.3.8", 36 | "@types/mocha": "^10.0.2", 37 | "@types/node": "^20.8.6", 38 | "@typescript-eslint/eslint-plugin": "^6.7.5", 39 | "@typescript-eslint/parser": "^6.7.5", 40 | "chai": "^4.3.10", 41 | "eslint": "^8.51.0", 42 | "latest-version": "^7.0.0", 43 | "mocha": "^10.2.0", 44 | "ts-mocha": "^10.0.0", 45 | "typescript": "^5.2.2" 46 | }, 47 | "dependencies": { 48 | "await-lock": "^2.2.2", 49 | "class-transformer": "^0.5.1", 50 | "commander": "^6.2.1", 51 | "deep-object-diff": "^1.1.9", 52 | "faker": "^4.1.0", 53 | "fast-copy": "^3.0.1", 54 | "fast-safe-stringify": "^2.1.1", 55 | "flat-promise": "^1.0.3", 56 | "glob": "^8.1.0", 57 | "istanbul-lib-hook": "^3.0.0", 58 | "istanbul-lib-instrument": "^6.0.1", 59 | "log-update": "^4.0.0", 60 | "make-matrix": "^2.3.3", 61 | "multee": "^0.2.4", 62 | "reflect-metadata": "^0.1.13", 63 | "tplant": "https://github.com/WeWatchWall/fast-fuzz/raw/main/tplant-3.1.2.tgz", 64 | "tslib": "^2.6.2" 65 | }, 66 | "peerDependencies": { 67 | "reflect-metadata": "^0.1.13", 68 | "typescript": "^5.X.X" 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/fast-fuzz.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import { fuzz } from './fuzz/fuzzCaller'; 3 | 4 | import { 5 | arg as fuzzArg, 6 | argType as fuzzArgType, 7 | method as fuzzMethod, 8 | prop as fuzzProp, 9 | propType as fuzzPropType, 10 | skipArg as fuzzSkipArg, 11 | skipMethod as fuzzSkipMethod, 12 | skipProp as fuzzSkipProp 13 | } from './decorators'; 14 | 15 | export { 16 | fuzz, 17 | fuzzArg, 18 | fuzzArgType, 19 | fuzzMethod, 20 | fuzzProp, 21 | fuzzPropType, 22 | fuzzSkipArg, 23 | fuzzSkipMethod, 24 | fuzzSkipProp 25 | } 26 | -------------------------------------------------------------------------------- /src/fuzz/fuzzCaller.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import path from 'path'; 3 | import os from 'os'; 4 | 5 | import logUpdate from 'log-update'; 6 | import safeStringify from 'fast-safe-stringify'; 7 | 8 | import { 9 | init as initSingle, 10 | count as countSingle, 11 | fuzz as fuzzSingle, 12 | getInstances as iSingle 13 | } from './fuzz'; 14 | import { FuzzRunner } from './fuzzRunner'; 15 | 16 | import { Results } from './result'; 17 | 18 | let instancesPath: string; 19 | let fuzzRunner: FuzzRunner; 20 | 21 | /** 22 | * Initializes the code analysis. 23 | * @param folder 24 | * @param [src] 25 | * @param [dist] 26 | */ 27 | async function init( 28 | folder: string, 29 | threads?: number, 30 | src?: string, 31 | dist?: string 32 | ): Promise { 33 | // Load the instances file. 34 | let instances: any; 35 | instancesPath = path.join(folder, '/fuzzInstances.json'); 36 | if (fs.existsSync(instancesPath)) { 37 | instances = JSON.parse(fs.readFileSync(instancesPath, 'utf8')); 38 | } 39 | 40 | // Initialize the worker. 41 | if (threads === 0) { 42 | await initSingle(folder, src, dist, instances); 43 | } 44 | else { 45 | fuzzRunner = new FuzzRunner(); 46 | await fuzzRunner.init(folder, src, dist, instances, threads); 47 | } 48 | 49 | } 50 | 51 | /** 52 | * Fuzz the TS folder. 53 | * @param folder 54 | * @param [maxTime] 55 | * @param [methodPattern] 56 | * @param [classPattern] 57 | * @param [src] 58 | * @param [dist] 59 | * @param [verbose] 60 | * @param [force] 61 | * @param [resultsOut] 62 | */ 63 | export async function fuzz( 64 | folder: string, 65 | threads?: number, 66 | maxTime = 1e4, 67 | methodPattern?: string, 68 | classPattern?: string, 69 | filePattern?: string, 70 | src?: string, 71 | dist?: string, 72 | verbose = false, 73 | force = false, 74 | resultsOut: Results[] = [] 75 | ): Promise { 76 | await init(folder, threads, src, dist); 77 | 78 | console.clear(); 79 | if (verbose) { 80 | let methodCount: number; 81 | if (threads === 0) { 82 | methodCount = await countSingle( 83 | methodPattern, 84 | classPattern, 85 | filePattern 86 | ); 87 | } else { 88 | methodCount = await fuzzRunner.count( 89 | methodPattern, 90 | classPattern, 91 | filePattern 92 | ); 93 | } 94 | 95 | // Calculate number of threads. 96 | let threadsOut = threads === undefined ? os.cpus().length : threads; 97 | threadsOut = threadsOut === 0 ? 1 : threadsOut; 98 | threadsOut = Math.min(threadsOut, methodCount); 99 | 100 | // Log the method count and estimates 101 | logUpdate(` 102 | Method count: ${methodCount}, 103 | Estimated time (s): ${(methodCount * maxTime / 1000) / threadsOut} 104 | `); 105 | logUpdate.done(); 106 | } 107 | let instances: any; 108 | if (threads === 0) { 109 | await fuzzSingle( 110 | maxTime, 111 | methodPattern, 112 | classPattern, 113 | filePattern, 114 | resultsOut 115 | ); 116 | 117 | instances = await iSingle(); 118 | } else { 119 | await fuzzRunner.fuzz( 120 | maxTime, 121 | methodPattern, 122 | classPattern, 123 | filePattern, 124 | resultsOut 125 | ); 126 | 127 | instances = await fuzzRunner.getInstances(); 128 | } 129 | 130 | if (threads !== 0) { 131 | fuzzRunner.terminate(); 132 | } 133 | 134 | saveInstances({ force, instances }); 135 | return resultsOut; 136 | } 137 | 138 | /** 139 | * Saves instances to file. 140 | * @param { force, instances } 141 | */ 142 | function saveInstances({ force, instances }: { 143 | force: boolean; 144 | instances: { 145 | [key: string]: { 146 | [key: string]: { 147 | instances: any[]; 148 | }; 149 | }; 150 | }; 151 | }) { 152 | if (!force && fs.existsSync(instancesPath)) { return; } 153 | 154 | const output = safeStringify(instances); 155 | 156 | fs.writeFileSync(instancesPath, output); 157 | } -------------------------------------------------------------------------------- /src/fuzz/fuzzSync.ts: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | import copy from "fast-copy"; 3 | import { diff } from 'deep-object-diff'; 4 | 5 | import { 6 | cleanupError, 7 | simpleHash, 8 | resetCoverage 9 | } from './util'; 10 | import { Mode } from "../generators/Mode"; 11 | import { Result } from "./result"; 12 | import { Globals } from "../utils/globals"; 13 | import { Generator } from "../generators/Generator"; 14 | import { ModuleMethod } from "../utils/modules"; 15 | 16 | const MODE_SCALE = 1.5; 17 | 18 | // Main fuzzing function that runs the tests and reports the results. 19 | export function fuzzSync( 20 | method: ModuleMethod, 21 | getArgs: Function, // eslint-disable-line 22 | testFunc: Function, // eslint-disable-line 23 | filePath: string, 24 | maxTime = 1e4, 25 | maxRuns = 1e5, 26 | resultsOut: Result[], 27 | persistInstances: Function // eslint-disable-line 28 | ): Result[] { 29 | // Resolve the system under test(SUT). 30 | filePath = path.resolve(filePath); 31 | if (!global.__coverage__[filePath]) { throw new Error(`File not found: ${filePath}`); } 32 | 33 | resetCoverage(filePath); 34 | 35 | // Scale the number of runs per mode. 36 | const maxRunsModes: number[] = []; 37 | const maxMode: number = Mode.High_2; 38 | let runsDiff = maxRuns; 39 | 40 | for (let index = maxMode + 1; index > 0; index--) { 41 | const runsPerMode = runsDiff / index; 42 | const scaleRuns = Math.floor(runsPerMode * MODE_SCALE); 43 | maxRunsModes.push(scaleRuns); 44 | 45 | runsDiff -= scaleRuns; 46 | } 47 | 48 | // Track progress. 49 | const covResults: Set = new Set(); 50 | 51 | // Loop through the modes and fuzz domain. 52 | let resultCount = 1; 53 | for (let mode = 0; mode <= maxMode; mode++) { 54 | // Set the generators to the new mode. 55 | Generator.mode = mode; 56 | Globals.mode = mode; 57 | 58 | // Vary the number of runs based on target area. 59 | let runCount = 0; 60 | let lastIndex = 0; 61 | const maxRunsMode: number = maxRunsModes.pop(); 62 | const maxRunsFailFast = Math.floor(0.682 * maxRunsMode); 63 | const maxRunsCheck: number = Math.pow(10, Math.max(1, Math.floor(Math.log10(maxRunsMode)) - 1)); 64 | const start: number = Date.now(); 65 | const runTime: number = maxTime * maxRunsMode / (MODE_SCALE * maxRuns); 66 | 67 | // Store coverage pointer for the sake of performance. 68 | const fileCoverage = { 69 | s: global.__coverage__[filePath].s, 70 | b: global.__coverage__[filePath].b, 71 | bT: global.__coverage__[filePath].bT 72 | }; 73 | 74 | // Test loop stats. 75 | let isExpired = false; 76 | 77 | // eslint-disable-next-line 78 | while (true) { 79 | // Check the running stats for termination. 80 | if (runCount % maxRunsCheck == 0) { 81 | isExpired = (Date.now() - start) > runTime; 82 | isExpired = isExpired || ((runCount - lastIndex) > maxRunsFailFast); 83 | } 84 | if (isExpired || runCount > maxRunsMode) { 85 | break; 86 | } 87 | runCount++; 88 | 89 | const args: any[] = getArgs(); 90 | let isError = false; 91 | let result: any; 92 | 93 | const covBefore: { 94 | s: any, 95 | b: any, 96 | bT: any 97 | } = copy(fileCoverage); 98 | 99 | // Run the function and report the error 100 | try { 101 | result = testFunc(args); 102 | } catch (error: any) { 103 | isError = true; 104 | result = error; 105 | } 106 | 107 | // Hash difference between coverage. 108 | let covDiff: string = JSON.stringify({ 109 | // f: diff(fileCoverageBefore?.f, fileCoverage.f), 110 | s: diff( 111 | covBefore === null || covBefore === void 0 ? void 0 : covBefore.s, 112 | fileCoverage.s 113 | ), 114 | b: diff( 115 | covBefore === null || covBefore === void 0 ? void 0 : covBefore.b, 116 | fileCoverage.b 117 | ), 118 | bT: diff( 119 | covBefore === null || covBefore === void 0 ? void 0 : covBefore.bT, 120 | fileCoverage.bT 121 | ) 122 | }); 123 | covDiff = covDiff.replace(/:\d+/g, ":1"); 124 | covDiff = covDiff.replace(/:null/g, ":1"); 125 | const coverageHash: string = simpleHash(covDiff); 126 | 127 | // Track coverage history. 128 | if (covResults.has(coverageHash)) { 129 | continue; 130 | } 131 | covResults.add(coverageHash); 132 | 133 | if (isError) { 134 | cleanupError(result); 135 | } 136 | 137 | // Update results. 138 | resultsOut.push(new Result({ 139 | id: resultCount++, 140 | modeId: mode, 141 | mode: Mode[mode], 142 | instance: method.test.instance, 143 | args: method.test.callArgs, 144 | result, coverageHash, runCount, 145 | speed: Number.parseFloat( 146 | (runCount * 1000 / (Date.now() - start)).toPrecision(4) 147 | ) 148 | })); 149 | 150 | // Clean up the global statements. 151 | const globalStatements = global.__coverage__[filePath].s 152 | for (const statementName in globalStatements) { 153 | globalStatements[statementName] = 0; 154 | } 155 | 156 | // Update accounting vars. 157 | lastIndex = runCount; 158 | persistInstances(); 159 | } 160 | } 161 | 162 | // Report the generated tests. 163 | return resultsOut; 164 | } 165 | -------------------------------------------------------------------------------- /src/fuzz/fuzzWorker.ts: -------------------------------------------------------------------------------- 1 | import { Results } from './result'; 2 | import { Call, workerInit } from './worker'; 3 | 4 | export class FuzzWorker { 5 | private worker = workerInit(); 6 | 7 | /** 8 | * Inits the local code analysis and type stuffing. 9 | * @param folder 10 | * @param [src] 11 | * @param [dist] 12 | * @param [instances] 13 | */ 14 | async init( 15 | folder: string, 16 | src?: string, 17 | dist?: string, 18 | instances?: any 19 | ): Promise { 20 | await this.worker.run({ 21 | name: Call.init, 22 | args: [folder, src, dist, instances] 23 | }); 24 | } 25 | 26 | /** 27 | * Counts the number of methods. 28 | * @param [methodPattern] 29 | * @param [classPattern] 30 | * @returns count of methods. 31 | */ 32 | async count( 33 | methodPattern?: string, 34 | classPattern?: string, 35 | filePattern?: string 36 | ): Promise { 37 | return await this.worker.run({ 38 | name: Call.count, 39 | args: [ 40 | methodPattern, 41 | classPattern, 42 | filePattern 43 | ] 44 | }); 45 | } 46 | 47 | /** 48 | * Fuzz the TS folder. 49 | * @param [maxTime] 50 | * @param [methodPattern] 51 | * @param [classPattern] 52 | * @param [resultsOut] 53 | */ 54 | async fuzz( 55 | maxTime = 1e4, 56 | methodPattern?: string, 57 | classPattern?: string, 58 | filePattern?: string, 59 | resultsOut: Results[] = [], 60 | index = 0, 61 | count = 0 62 | ): Promise { 63 | const result = JSON.parse(await this.worker.run({ 64 | name: Call.fuzz, 65 | args: [ 66 | maxTime, 67 | methodPattern, 68 | classPattern, 69 | filePattern, 70 | undefined, 71 | index, 72 | count 73 | ] 74 | })); 75 | 76 | // Append the fuzzing results. 77 | resultsOut.push(...result); 78 | return resultsOut; 79 | } 80 | 81 | /** 82 | * Gets instances. 83 | * @returns instances 84 | */ 85 | async getInstances(): Promise { 86 | return JSON.parse(await this.worker.run({ 87 | name: Call.getInstances, 88 | args: [] 89 | })); 90 | } 91 | 92 | /** 93 | * Terminates fuzz worker. 94 | */ 95 | terminate(): void { 96 | this.worker.worker.terminate(); 97 | } 98 | } -------------------------------------------------------------------------------- /src/fuzz/result.ts: -------------------------------------------------------------------------------- 1 | import { Mode } from "../generators/Mode"; 2 | 3 | export class Result { 4 | id: number; 5 | instance?: any; 6 | args: any[]; 7 | result?: any; 8 | modeId: Mode; 9 | mode: string; 10 | coverageHash: string; 11 | runCount: number; 12 | speed: number; 13 | isCovered: boolean; 14 | error?: string; 15 | 16 | constructor(init: Partial) { 17 | Object.assign(this, init); 18 | } 19 | } 20 | 21 | export class Results { 22 | name: string; 23 | className?: string; 24 | namespaces: string[]; 25 | file: string; 26 | avgSpeed: number; 27 | results: Result[]; 28 | } -------------------------------------------------------------------------------- /src/fuzz/util.ts: -------------------------------------------------------------------------------- 1 | // Cleanup the error stack. 2 | export function cleanupError(error: any) { 3 | const stack = error.stack.split('\n'); 4 | 5 | stack.splice(-8); 6 | error.stack = stack.join('\n'); 7 | } 8 | 9 | // Sets all the branch stats to 0. 10 | export function resetCoverage (fileName: string) { 11 | const fileCov: any = global.__coverage__[fileName]; 12 | fileCov.s = {}; 13 | for (const key in fileCov.b) { 14 | const branchCov: any = fileCov.b[key]; 15 | for (const index in branchCov) { 16 | branchCov[index] = 0; 17 | } 18 | } 19 | for (const key in fileCov.bT) { 20 | const branchCov: any = fileCov.bT[key]; 21 | for (const index in branchCov) { 22 | branchCov[index] = 0; 23 | } 24 | } 25 | return true; 26 | } 27 | 28 | // Fastest known hash method for a string. 29 | export function simpleHash (str: string) { 30 | let hash = 0; 31 | for (let i = 0; i < str.length; i++) { 32 | const char: number = str.charCodeAt(i); 33 | hash = (hash << 5) - hash + char; 34 | hash &= hash; // Convert to 32bit integer 35 | } 36 | return new Uint32Array([hash])[0].toString(36); 37 | } -------------------------------------------------------------------------------- /src/fuzz/worker.ts: -------------------------------------------------------------------------------- 1 | // import { fastFuzz } from './fuzzNew'; 2 | import Multee from 'multee'; 3 | import safeStringify from 'fast-safe-stringify'; 4 | 5 | import { 6 | init, 7 | count, 8 | fuzz, 9 | getInstances 10 | } from './fuzz'; 11 | 12 | const multee = Multee('worker'); // 'worker' for worker_threads | 'child' for child_process 13 | 14 | const job = multee.createHandler( 15 | 'job', 16 | async (callArgs: { 17 | name: Call, 18 | args: any[] 19 | }): Promise => { 20 | switch (callArgs.name) { 21 | case Call.init: 22 | // Add JSON writer to all the errors. 23 | if (!('toJSON' in Error.prototype)) { 24 | Object.defineProperty(Error.prototype, 'toJSON', { 25 | value: function () { 26 | const alt = {}; 27 | alt['name'] = this.name; 28 | 29 | Object.getOwnPropertyNames(this).forEach((key) => { 30 | alt[key] = this[key]; 31 | }, this); 32 | 33 | return alt; 34 | }, 35 | configurable: true, 36 | writable: true 37 | }); 38 | } 39 | 40 | return await init( 41 | callArgs.args[0], 42 | callArgs.args[1], 43 | callArgs.args[2], 44 | callArgs.args[3] 45 | ); 46 | case Call.count: 47 | return await count( 48 | callArgs.args[0], 49 | callArgs.args[1], 50 | callArgs.args[2] 51 | ); 52 | case Call.fuzz: 53 | return safeStringify(await fuzz( 54 | callArgs.args[0], 55 | callArgs.args[1], 56 | callArgs.args[2], 57 | callArgs.args[3], 58 | callArgs.args[4], 59 | callArgs.args[5], 60 | callArgs.args[6] 61 | )); 62 | case Call.getInstances: 63 | return safeStringify(await getInstances()); 64 | } 65 | 66 | } 67 | ); 68 | 69 | export enum Call { 70 | init, 71 | count, 72 | fuzz, 73 | getInstances 74 | } 75 | 76 | export const workerInit = () => { 77 | const worker = multee.start(__filename); 78 | return { 79 | run: job(worker), 80 | worker: worker 81 | }; 82 | } -------------------------------------------------------------------------------- /src/generators/GeneratorArg.ts: -------------------------------------------------------------------------------- 1 | import { mock } from "../intermock/build/index"; 2 | import { Limits } from "../utils/limits"; 3 | import { Generator } from "./Generator"; 4 | 5 | export class GeneratorArg extends Generator { 6 | private interfaces: [string, string][]; 7 | 8 | constructor(interfaces: [string, string][]) { 9 | super(0, new Limits({}), [], 0); 10 | 11 | // Create the interfaces for each type, excluding IFuzzArgs(TODO?). 12 | this.interfaces = interfaces; 13 | } 14 | 15 | generate(count: number): any[] { 16 | return mock({ 17 | files: this.interfaces, 18 | interfaces: ['IFuzzArgs'], 19 | isOptionalAlwaysEnabled: true, 20 | output: 'object', 21 | count: count 22 | })['IFuzzArgs']; 23 | } 24 | 25 | next(): any { 26 | return Generator.next(this).result; 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/generators/GeneratorBool.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | import { Generator } from "./Generator"; 3 | import { Mode } from "./Mode"; 4 | 5 | export class GeneratorBool extends Generator { 6 | constructor(dimension = 0, index?: number) { 7 | super(dimension, new Limits({}), [], index); 8 | this.falsyLiterals = this.falsyLiterals.concat([false]); 9 | } 10 | 11 | generate(count: number): boolean[] { 12 | const result: any[] = []; 13 | 14 | switch (Generator.mode) { 15 | case Mode.Falsy: 16 | for (let index = 0; index < count; index++) { 17 | result.push( 18 | this.falsyLiterals[ 19 | Generator.getRandomIndex(this.falsyLiterals.length) 20 | ] 21 | ); 22 | } 23 | break; 24 | case Mode.Stuff: 25 | default: 26 | for (let index = 0; index < count; index++) { 27 | if (Math.random() > Generator.P_FALSY) { 28 | result.push( 29 | this.falsyLiterals[ 30 | Generator.getRandomIndex(this.falsyLiterals.length) 31 | ] 32 | ); 33 | continue; 34 | } 35 | 36 | result.push(!!Generator.getRandomIndex(2)); 37 | } 38 | break; 39 | } 40 | 41 | return result; 42 | } 43 | 44 | next(): any { 45 | return Generator.next(this).result; 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/generators/GeneratorDate.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | import { Generator } from "./Generator"; 3 | import { Mode } from "./Mode"; 4 | 5 | export class GeneratorDate extends Generator { 6 | private static MODE_SCALE = 0.25; 7 | 8 | constructor( 9 | dimension = 0, 10 | literals: string[], 11 | min?: number, 12 | max?: number, 13 | index?: number 14 | ) { 15 | super( 16 | dimension, 17 | new Limits({ date: { min, max } }), 18 | Generator.getLiterals('date', literals), 19 | index 20 | ); 21 | this.falsyLiterals = this.falsyLiterals.concat([ 22 | new Date(0), 23 | new Date(Date.parse('0')), 24 | new Date(-8640e12), 25 | new Date(8640e12) 26 | ]); 27 | } 28 | 29 | generate(count: number): Date[] { 30 | const result: any[] = []; 31 | 32 | if (Generator.mode === Mode.Falsy) { 33 | for (let index = 0; index < count; index++) { 34 | result.push( 35 | this.falsyLiterals[ 36 | Generator.getRandomIndex(this.falsyLiterals.length) 37 | ] 38 | ); 39 | } 40 | } else if (Generator.mode === Mode.Stuff && this.literals.length > 0) { 41 | for (let index = 0; index < count; index++) { 42 | if (Math.random() > Generator.P_FALSY) { 43 | result.push( 44 | this.falsyLiterals[ 45 | Generator.getRandomIndex(this.falsyLiterals.length) 46 | ] 47 | ); 48 | continue; 49 | } 50 | 51 | result.push( 52 | this.literals[Generator.getRandomIndex(this.literals.length)] 53 | ); 54 | } 55 | } else { 56 | const [min, max]: [number, number] = GeneratorDate.getLimits( 57 | Generator.mode, 58 | this.limits.date.min, 59 | this.limits.date.max 60 | ); 61 | 62 | for (let index = 0; index < count; index++) { 63 | const random = Math.random(); 64 | if (random > Generator.P_FALSY) { 65 | result.push( 66 | this.falsyLiterals[ 67 | Generator.getRandomIndex(this.falsyLiterals.length) 68 | ] 69 | ); 70 | continue; 71 | } else if (random > Generator.P_STUFF && this.literals.length > 0) { 72 | result.push( 73 | this.literals[Generator.getRandomIndex(this.literals.length)] 74 | ); 75 | continue; 76 | } 77 | 78 | result.push(new Date(Generator.getRandomInt(min, max))); 79 | } 80 | } 81 | 82 | return result; 83 | } 84 | 85 | next(): any { 86 | return Generator.next(this).result; 87 | } 88 | 89 | /** 90 | * Gets limits based on mode. 91 | * @param mode 92 | * @param min 93 | * @param max 94 | * @returns limits 95 | */ 96 | private static getLimits( 97 | mode: Mode, 98 | min: number, 99 | max: number 100 | ): [number, number] { 101 | const diff = max - min; 102 | 103 | switch (mode) { 104 | case Mode.Falsy: 105 | case Mode.Stuff: 106 | case Mode.Low_1: 107 | return [ 108 | min + diff * GeneratorDate.MODE_SCALE * 1.5, 109 | max - diff * GeneratorDate.MODE_SCALE * 1.5 110 | ]; 111 | case Mode.Low_2: 112 | return [ 113 | min + diff * GeneratorDate.MODE_SCALE, 114 | max - diff * GeneratorDate.MODE_SCALE 115 | ]; 116 | case Mode.Medium: 117 | return [min, max]; 118 | case Mode.High_1: 119 | return [ 120 | min - diff * GeneratorDate.MODE_SCALE * 4, 121 | max + diff * GeneratorDate.MODE_SCALE * 4 122 | ]; 123 | case Mode.High_2: 124 | return [ 125 | min - diff * GeneratorDate.MODE_SCALE * 40, 126 | max + diff * GeneratorDate.MODE_SCALE * 40 127 | ]; 128 | } 129 | } 130 | } -------------------------------------------------------------------------------- /src/generators/GeneratorEnum.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | import { ModuleType } from "../utils/modules"; 3 | import { Generator } from "./Generator"; 4 | import { Mode } from "./Mode"; 5 | 6 | export class GeneratorEnum extends Generator { 7 | private type: ModuleType; 8 | private renderer: IntEnumRender | DictionaryEnumRender; 9 | private isInit: boolean; 10 | 11 | constructor(type: ModuleType, dimension = 0, index?: number) { 12 | super(dimension, new Limits({}), [], index); 13 | this.falsyLiterals = this.falsyLiterals.concat([ 14 | NaN, 0, -0, 15 | Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 16 | -1 * Number.MIN_VALUE, Number.MIN_VALUE, 17 | -1 * Number.MAX_VALUE, Number.MAX_VALUE, 18 | Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, 19 | '', 'RkeRxOSF4BfSpgc5Dc7hGumMO' 20 | ]); 21 | this.type = type; 22 | this.isInit = false; 23 | } 24 | 25 | generate(count: number): any[] { 26 | let result: any[] = []; 27 | 28 | this.init(); 29 | 30 | switch (Generator.mode) { 31 | case Mode.Falsy: 32 | for (let index = 0; index < count; index++) { 33 | result.push(this.falsyLiterals[Generator.getRandomIndex(this.falsyLiterals.length)]); 34 | } 35 | break; 36 | default: 37 | result = this.renderer.render(count, this.falsyLiterals); 38 | break; 39 | } 40 | 41 | return result; 42 | } 43 | 44 | next(): any { 45 | return Generator.next(this).result; 46 | } 47 | 48 | private init(): void { 49 | if (this.isInit) { return; } 50 | 51 | // Full integer enums are faster than lookup enums. 52 | const enumObject: any = Generator.getType(this.type); 53 | 54 | const numbers: number[] = []; 55 | const strings: string[] = []; 56 | 57 | Object.keys(enumObject).forEach((key: string) => { 58 | const numericKey = Number.parseInt(key); 59 | if (Number.isInteger(numericKey)) { 60 | numbers.push(numericKey); 61 | } else { 62 | strings.push(key); 63 | } 64 | }); 65 | 66 | let isInteger: boolean; 67 | const min = numbers[0]; 68 | let max = min; 69 | if (numbers.length === strings.length) { 70 | isInteger = true; 71 | numbers.forEach((key: number, index: number) => { 72 | if (key - min !== index) { isInteger = false; } 73 | max = key; 74 | }); 75 | } else { 76 | isInteger = false; 77 | } 78 | 79 | if (isInteger) { 80 | this.renderer = new IntEnumRender(min, max); 81 | } else { 82 | const values = strings.map((value: string) => { 83 | // Check for numbers. 84 | const numValue = Number.parseFloat(value); 85 | if (!Number.isNaN(numValue)) { 86 | return numValue; 87 | } 88 | 89 | return enumObject[value]; 90 | }); 91 | this.renderer = new DictionaryEnumRender(values); 92 | } 93 | 94 | this.isInit = true; 95 | } 96 | } 97 | 98 | /** 99 | * Integer enum render. 100 | */ 101 | class IntEnumRender { 102 | private min: number; 103 | private max: number; 104 | 105 | constructor(min: number, max: number) { 106 | this.min = min; 107 | this.max = max; 108 | } 109 | 110 | render(count: number, falsyLiterals: any[]): number[] { 111 | // Array of random integers. 112 | const results: number[] = []; 113 | for (let i = 0; i < count; i++) { 114 | if ( 115 | Math.random() > Generator.P_FALSY 116 | ) { 117 | results.push( 118 | falsyLiterals[ 119 | Generator.getRandomIndex(falsyLiterals.length) 120 | ] 121 | ); 122 | continue; 123 | } 124 | 125 | results.push(Generator.getRandomInt(this.min, this.max)); 126 | } 127 | return results; 128 | } 129 | } 130 | 131 | /** 132 | * Dictionary enum render. 133 | */ 134 | class DictionaryEnumRender { 135 | private values: (string | number)[]; 136 | private maxIndex: number; 137 | 138 | constructor(values: (string | number)[]) { 139 | this.values = values; 140 | this.maxIndex = this.values.length; 141 | } 142 | 143 | render(count: number, falsyLiterals: any[]): (string | number)[] { 144 | // Values from an array of random indices. 145 | const results: (number | string)[] = []; 146 | for (let i = 0; i < count; i++) { 147 | if ( 148 | Math.random() > Generator.P_FALSY 149 | ) { 150 | results.push( 151 | falsyLiterals[ 152 | Generator.getRandomIndex(falsyLiterals.length) 153 | ] 154 | ); 155 | continue; 156 | } 157 | 158 | results.push(this.values[Generator.getRandomIndex(this.maxIndex)]); 159 | } 160 | return results; 161 | } 162 | } -------------------------------------------------------------------------------- /src/generators/GeneratorFactory.ts: -------------------------------------------------------------------------------- 1 | import { BuiltIn } from "../utils/decorators"; 2 | import { ModuleType } from "../utils/modules"; 3 | import { GeneratorBool } from "./GeneratorBool"; 4 | import { GeneratorDate } from "./GeneratorDate"; 5 | import { GeneratorEnum } from "./GeneratorEnum"; 6 | import { GeneratorFloat } from "./GeneratorFloat"; 7 | import { GeneratorInt } from "./GeneratorInt"; 8 | import { GeneratorString } from "./GeneratorString"; 9 | import { GeneratorType } from "./GeneratorType"; 10 | import { IGenerator } from "./IGenerator"; 11 | import { Mode } from "./Mode"; 12 | 13 | export class GeneratorFactory { 14 | 15 | /** 16 | * Factory method for generators for the built-in types. 17 | * @param type 18 | * @param [dimension] 19 | * @param [literals] 20 | * @param [index] 21 | * @param [min] 22 | * @param [max] 23 | * @returns init 24 | */ 25 | static init( 26 | type: BuiltIn, 27 | dimension = 0, 28 | literals: string[], 29 | index?: number, 30 | min?: number, 31 | max?: number 32 | ): IGenerator { 33 | switch (type) { 34 | case 'boolean': 35 | return new GeneratorBool(dimension, index); 36 | case 'integer': 37 | return new GeneratorInt(dimension, literals, min, max, index); 38 | case 'float': 39 | return new GeneratorFloat(dimension, literals, min, max, index); 40 | case 'date': 41 | return new GeneratorDate(dimension, literals, min, max, index); 42 | case 'string': 43 | return new GeneratorString(dimension, literals, min, max, index); 44 | default: 45 | break; 46 | } 47 | 48 | return null; 49 | } 50 | 51 | /** 52 | * Factory method for generators for custom types. 53 | * @param type 54 | * @param [dimension] 55 | * @param [index] 56 | */ 57 | static initType( 58 | type: ModuleType, 59 | dimension = 0, 60 | index?: number, 61 | mode?: Mode, 62 | isIgnoreFalsy = false 63 | ): IGenerator { 64 | if (type.kind === 'enum') { 65 | return new GeneratorEnum(type, dimension, index); 66 | } else { 67 | return new GeneratorType(type, dimension, index, mode, isIgnoreFalsy); 68 | } 69 | } 70 | 71 | } -------------------------------------------------------------------------------- /src/generators/GeneratorFalsy.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | import { Generator } from "./Generator"; 3 | 4 | export class GeneratorFalsy extends Generator { 5 | constructor(dimension = 0, index?: number) { 6 | super(dimension, new Limits({}), [], index); 7 | } 8 | 9 | generate(count: number): boolean[] { 10 | const result: any[] = []; 11 | 12 | for (let index = 0; index < count; index++) { 13 | result.push(this.falsyLiterals[Generator.getRandomIndex(this.falsyLiterals.length)]); 14 | } 15 | 16 | return result; 17 | } 18 | 19 | next(): any { 20 | return Generator.next(this).result; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /src/generators/GeneratorFloat.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | import { Generator } from "./Generator"; 3 | import { Mode } from "./Mode"; 4 | 5 | export class GeneratorFloat extends Generator { 6 | private static MODE_SCALE = 0.25; 7 | 8 | constructor( 9 | dimension = 0, 10 | literals: string[], 11 | min?: number, 12 | max?: number, 13 | index?: number 14 | ) { 15 | super( 16 | dimension, 17 | new Limits({ float: { min, max } }), 18 | Generator.getLiterals('float', literals), 19 | index 20 | ); 21 | this.falsyLiterals = this.falsyLiterals.concat([ 22 | NaN, 0, -0, 23 | -1 * Number.MIN_VALUE, Number.MIN_VALUE, 24 | -1 * Number.MAX_VALUE, Number.MAX_VALUE, 25 | Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY 26 | ]); 27 | } 28 | 29 | generate(count: number): number[] { 30 | const result: any[] = []; 31 | 32 | if (Generator.mode === Mode.Falsy) { 33 | for (let index = 0; index < count; index++) { 34 | result.push( 35 | this.falsyLiterals[ 36 | Generator.getRandomIndex(this.falsyLiterals.length) 37 | ] 38 | ); 39 | } 40 | } else if (Generator.mode === Mode.Stuff && this.literals.length > 0) { 41 | for (let index = 0; index < count; index++) { 42 | if (Math.random() > Generator.P_FALSY) { 43 | result.push( 44 | this.falsyLiterals[ 45 | Generator.getRandomIndex(this.falsyLiterals.length) 46 | ] 47 | ); 48 | continue; 49 | } 50 | 51 | result.push( 52 | this.literals[Generator.getRandomIndex(this.literals.length)] 53 | ); 54 | } 55 | } else { 56 | const [min, max]: [number, number] = GeneratorFloat.getLimits( 57 | Generator.mode, 58 | this.limits.float.min, 59 | this.limits.float.max 60 | ); 61 | 62 | for (let index = 0; index < count; index++) { 63 | const random = Math.random(); 64 | if (random > Generator.P_FALSY) { 65 | result.push( 66 | this.falsyLiterals[ 67 | Generator.getRandomIndex(this.falsyLiterals.length) 68 | ] 69 | ); 70 | continue; 71 | } else if (random > Generator.P_STUFF && this.literals.length > 0) { 72 | result.push( 73 | this.literals[Generator.getRandomIndex(this.literals.length)] 74 | ); 75 | continue; 76 | } 77 | 78 | result.push(GeneratorFloat.getRandomFloat(min, max)); 79 | } 80 | } 81 | 82 | return result; 83 | } 84 | 85 | next(): any { 86 | return Generator.next(this).result; 87 | } 88 | 89 | /** 90 | * Returns a random number between min (inclusive) and max (exclusive) 91 | */ 92 | static getRandomFloat(min: number, max: number) { 93 | return Math.random() * (max - min) + min; 94 | } 95 | 96 | /** 97 | * Gets limits based on mode. 98 | * @param mode 99 | * @param min 100 | * @param max 101 | * @returns limits 102 | */ 103 | private static getLimits( 104 | mode: Mode, 105 | min: number, 106 | max: number 107 | ): [number, number] { 108 | const diff = max - min; 109 | 110 | switch (mode) { 111 | case Mode.Falsy: 112 | case Mode.Stuff: 113 | case Mode.Low_1: 114 | return [ 115 | min + diff * GeneratorFloat.MODE_SCALE * 1.5, 116 | max - diff * GeneratorFloat.MODE_SCALE * 1.5 117 | ]; 118 | case Mode.Low_2: 119 | return [ 120 | min + diff * GeneratorFloat.MODE_SCALE, 121 | max - diff * GeneratorFloat.MODE_SCALE 122 | ]; 123 | case Mode.Medium: 124 | return [min, max]; 125 | case Mode.High_1: 126 | return [ 127 | min - diff * GeneratorFloat.MODE_SCALE * 4, 128 | max + diff * GeneratorFloat.MODE_SCALE * 4 129 | ]; 130 | case Mode.High_2: 131 | return [ 132 | min - diff * GeneratorFloat.MODE_SCALE * 40, 133 | max + diff * GeneratorFloat.MODE_SCALE * 40 134 | ]; 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /src/generators/GeneratorInt.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | import { Generator } from "./Generator"; 3 | import { Mode } from "./Mode"; 4 | 5 | export class GeneratorInt extends Generator { 6 | private static MODE_SCALE = 0.25; 7 | 8 | constructor( 9 | dimension = 0, 10 | literals: string[], 11 | min?: number, 12 | max?: number, 13 | index?: number 14 | ) { 15 | super( 16 | dimension, 17 | new Limits({ int: { min, max } }), 18 | Generator.getLiterals('integer', literals), 19 | index 20 | ); 21 | this.falsyLiterals = this.falsyLiterals.concat([ 22 | NaN, 0, -0, 23 | Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER 24 | ]); 25 | } 26 | 27 | generate(count: number): number[] { 28 | const result: any[] = []; 29 | 30 | if (Generator.mode === Mode.Falsy) { 31 | for (let index = 0; index < count; index++) { 32 | result.push(this.falsyLiterals[ 33 | Generator.getRandomIndex(this.falsyLiterals.length)] 34 | ); 35 | } 36 | } else if (Generator.mode === Mode.Stuff && this.literals.length > 0) { 37 | for (let index = 0; index < count; index++) { 38 | if (Math.random() > Generator.P_FALSY) { 39 | result.push( 40 | this.falsyLiterals[ 41 | Generator.getRandomIndex(this.falsyLiterals.length) 42 | ] 43 | ); 44 | continue; 45 | } 46 | 47 | result.push( 48 | this.literals[Generator.getRandomIndex(this.literals.length)] 49 | ); 50 | } 51 | } else { 52 | const [min, max]: [number, number] = GeneratorInt.getLimits( 53 | Generator.mode, 54 | this.limits.int.min, 55 | this.limits.int.max 56 | ); 57 | 58 | for (let index = 0; index < count; index++) { 59 | const random = Math.random(); 60 | if (random > Generator.P_FALSY) { 61 | result.push( 62 | this.falsyLiterals[ 63 | Generator.getRandomIndex(this.falsyLiterals.length) 64 | ] 65 | ); 66 | continue; 67 | } else if (random > Generator.P_STUFF && this.literals.length > 0) { 68 | result.push( 69 | this.literals[Generator.getRandomIndex(this.literals.length)] 70 | ); 71 | continue; 72 | } 73 | 74 | result.push(Generator.getRandomInt(min, max)); 75 | } 76 | } 77 | 78 | return result; 79 | } 80 | 81 | next(): any { 82 | return Generator.next(this).result; 83 | } 84 | 85 | /** 86 | * Gets limits based on mode. 87 | * @param mode 88 | * @param min 89 | * @param max 90 | * @returns limits 91 | */ 92 | private static getLimits( 93 | mode: Mode, 94 | min: number, 95 | max: number 96 | ): [number, number] { 97 | const diff = max - min; 98 | 99 | switch (mode) { 100 | case Mode.Falsy: 101 | case Mode.Stuff: 102 | case Mode.Low_1: 103 | return [ 104 | min + diff * GeneratorInt.MODE_SCALE * 1.5, 105 | max - diff * GeneratorInt.MODE_SCALE * 1.5 106 | ]; 107 | case Mode.Low_2: 108 | return [ 109 | min + diff * GeneratorInt.MODE_SCALE, 110 | max - diff * GeneratorInt.MODE_SCALE 111 | ]; 112 | case Mode.Medium: 113 | return [min, max]; 114 | case Mode.High_1: 115 | return [ 116 | min - diff * GeneratorInt.MODE_SCALE * 4, 117 | max + diff * GeneratorInt.MODE_SCALE * 4 118 | ]; 119 | case Mode.High_2: 120 | return [ 121 | min - diff * GeneratorInt.MODE_SCALE * 40, 122 | max + diff * GeneratorInt.MODE_SCALE * 40 123 | ]; 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /src/generators/GeneratorString.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | import { Generator } from "./Generator"; 3 | import { Mode } from "./Mode"; 4 | 5 | /** 6 | * Generator for strings. Just for stuffind or placeholders. 7 | * Not usually used in logic because of their combinatorial explosion. 8 | */ 9 | export class GeneratorString extends Generator { 10 | private static MODE_SCALE = 1; 11 | 12 | constructor( 13 | dimension = 0, 14 | literals: string[], 15 | min?: number, 16 | max?: number, 17 | index?: number 18 | ) { 19 | super( 20 | dimension, 21 | new Limits({ string: { min, max } }), 22 | Generator.getLiterals('string', literals), 23 | index 24 | ); 25 | this.falsyLiterals = this.falsyLiterals.concat([ 26 | '', 'RkeRxOSF4BfSpgc5Dc7hGumMO' 27 | ]); 28 | } 29 | 30 | generate(count: number): string[] { 31 | const result: any[] = []; 32 | 33 | if (Generator.mode === Mode.Falsy) { 34 | for (let index = 0; index < count; index++) { 35 | result.push( 36 | this.falsyLiterals[ 37 | Generator.getRandomIndex(this.falsyLiterals.length) 38 | ] 39 | ); 40 | } 41 | } else if (Generator.mode === Mode.Stuff && this.literals.length > 0) { 42 | for (let index = 0; index < count; index++) { 43 | if (Math.random() > Generator.P_FALSY) { 44 | result.push( 45 | this.falsyLiterals[ 46 | Generator.getRandomIndex(this.falsyLiterals.length) 47 | ] 48 | ); 49 | continue; 50 | } 51 | 52 | result.push( 53 | this.literals[Generator.getRandomIndex(this.literals.length)] 54 | ); 55 | } 56 | } else { 57 | const [min, max]: [number, number] = GeneratorString.getLimits( 58 | Generator.mode, 59 | this.limits.string.min, 60 | this.limits.string.max 61 | ); 62 | 63 | for (let index = 0; index < count; index++) { 64 | const random = Math.random(); 65 | if (random > Generator.P_FALSY) { 66 | result.push( 67 | this.falsyLiterals[ 68 | Generator.getRandomIndex(this.falsyLiterals.length) 69 | ] 70 | ); 71 | continue; 72 | } else if (random > 0.2 && this.literals.length > 0) { 73 | result.push( 74 | this.literals[Generator.getRandomIndex(this.literals.length)] 75 | ); 76 | continue; 77 | } 78 | 79 | result.push( 80 | `${Math.random().toString(36)}00000000000000000` 81 | .slice( 82 | 2, 83 | Generator.getRandomInt(min, max) + 2 84 | ) 85 | ); 86 | } 87 | } 88 | 89 | return result; 90 | } 91 | 92 | next(): any { 93 | return Generator.next(this).result; 94 | } 95 | 96 | 97 | /** 98 | * Gets limits based on mode. 99 | * @param mode 100 | * @param min 101 | * @param max 102 | * @returns limits 103 | */ 104 | private static getLimits( 105 | mode: Mode, 106 | min: number, 107 | max: number 108 | ): [number, number] { 109 | switch (mode) { 110 | case Mode.Falsy: 111 | case Mode.Stuff: 112 | case Mode.Low_1: 113 | case Mode.Low_2: 114 | return [ 115 | Math.max(1, min + GeneratorString.MODE_SCALE), 116 | Math.max(2, max - GeneratorString.MODE_SCALE), 117 | ]; 118 | case Mode.Medium: 119 | return [min, max]; 120 | case Mode.High_1: 121 | return [ 122 | Math.max(1, min - GeneratorString.MODE_SCALE), 123 | Math.max(2, max + GeneratorString.MODE_SCALE) 124 | ]; 125 | case Mode.High_2: 126 | return [ 127 | Math.max(1, min - GeneratorString.MODE_SCALE * 2), 128 | Math.max(2, max + GeneratorString.MODE_SCALE * 2) 129 | ]; 130 | } 131 | } 132 | } -------------------------------------------------------------------------------- /src/generators/IGenerator.ts: -------------------------------------------------------------------------------- 1 | import { Limits } from "../utils/limits"; 2 | 3 | export interface IGenerator { 4 | index: number; 5 | limits: Limits; 6 | dimension: number; 7 | 8 | batchSize: number; 9 | values: any[]; 10 | 11 | generate(count: number): any[]; 12 | next(): any; 13 | } -------------------------------------------------------------------------------- /src/generators/Mode.ts: -------------------------------------------------------------------------------- 1 | export enum Mode { 2 | Falsy, 3 | Low_1, 4 | Stuff, 5 | Low_2, 6 | High_1, 7 | Medium, 8 | High_2, 9 | } -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const FlatPromise = require('flat-promise'); 3 | import commander from 'commander'; 4 | import logUpdate from 'log-update'; 5 | import safeStringify from 'fast-safe-stringify'; 6 | 7 | import { fuzz } from './fuzz/fuzzCaller'; 8 | import { Results } from './fuzz/result'; 9 | 10 | commander 11 | .addHelpCommand() 12 | .version(require('../../package').version) 13 | .option('-i, --input ', 'Path of the Typescript project.') 14 | .option('-n, --threads ', 'The number of parallel threads. Default = OS defined. 0 for in-process.') 15 | .option('-t, --maxTime ', 'The maximum time(ms) per function. Actual value is multiplied by 4. Default = 10s.') 16 | .option('-m, --methods ', 'A Regex expression to filter the methods to test.') 17 | .option('-c, --classes ', 'A Regex expression to filter the classes to test.') 18 | .option('-f, --files ', 'A Regex expression to filter the files to test.') 19 | .option('-s, --source ', 'Path of the source folder relative to the project.') 20 | .option('-d, --dist ', 'Path of the binary folder relative to the project.') 21 | .option('-F, --force true', 'Force overwrite fuzz instances JSON file.') 22 | .option('-q, --quiet true', 'Only output the results JSON.') 23 | .parse(process.argv); 24 | 25 | if (!commander.input) { 26 | console.error('Missing input folder.'); 27 | process.exit(1); 28 | } 29 | 30 | async function Main() { 31 | if (commander.threads !== undefined) { 32 | commander.threads = Number.parseInt(commander.threads); 33 | if (Number.isNaN(commander.threads)) { delete commander.threads; } 34 | } 35 | if (commander.maxTime !== undefined) { 36 | commander.maxTime = Number.parseFloat(commander.maxTime); 37 | if (Number.isNaN(commander.maxTime)) { delete commander.maxTime; } 38 | } 39 | commander.quiet = commander.quiet !== undefined; 40 | commander.force = commander.force !== undefined; 41 | 42 | if (!('toJSON' in Error.prototype)) { 43 | Object.defineProperty(Error.prototype, 'toJSON', { 44 | value: function () { 45 | const alt = {}; 46 | alt['name'] = this.name; 47 | 48 | Object.getOwnPropertyNames(this).forEach((key) => { 49 | alt[key] = this[key]; 50 | }, this); 51 | 52 | return alt; 53 | }, 54 | configurable: true, 55 | writable: true 56 | }); 57 | } 58 | 59 | // Just wait for results for non-interactive session. 60 | if (commander.quiet) { 61 | console.log(safeStringify(await fuzz( 62 | commander.input, 63 | commander.threads, 64 | commander.maxTime, 65 | commander.methods, 66 | commander.classes, 67 | commander.files, 68 | commander.source, 69 | commander.dist, 70 | !commander.quiet, 71 | commander.force 72 | ))); 73 | return; 74 | } 75 | 76 | // Show intermediate results. 77 | const start: number = Date.now(); 78 | const results: Results[] = []; 79 | let isResolved = false; 80 | fuzz( 81 | commander.input, 82 | commander.threads, 83 | commander.maxTime, 84 | commander.methods, 85 | commander.classes, 86 | commander.files, 87 | commander.source, 88 | commander.dist, 89 | !commander.quiet, 90 | commander.force, 91 | results 92 | ).then(() => { 93 | isResolved = true; 94 | }); 95 | 96 | while (!isResolved) { 97 | await wait(5000); 98 | 99 | logUpdate(safeStringify(results)); 100 | } 101 | 102 | logUpdate(safeStringify(results)); 103 | logUpdate.done(); 104 | logUpdate(` 105 | Time elapsed (s): ${(Date.now() - start) / 1e3} 106 | `); 107 | logUpdate.done(); 108 | } 109 | Main(); 110 | 111 | async function wait(ms) { 112 | const flatPromise = new FlatPromise(); 113 | 114 | setTimeout(() => flatPromise.resolve(), ms); 115 | return flatPromise.promise; 116 | } -------------------------------------------------------------------------------- /src/intermock/build/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { mock } from './src/index'; 17 | export { mock }; 18 | -------------------------------------------------------------------------------- /src/intermock/build/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * Copyright 2019 Google Inc. All Rights Reserved. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | const index_1 = require("./src/index"); 19 | exports.mock = index_1.mock; 20 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /src/intermock/build/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;GAcG;AACH,uCAAiC;AAEzB,eAFA,YAAI,CAEA"} -------------------------------------------------------------------------------- /src/intermock/build/src/cli/index.d.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | export {}; 3 | -------------------------------------------------------------------------------- /src/intermock/build/src/cli/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | "use strict"; 3 | Object.defineProperty(exports, "__esModule", { value: true }); 4 | const tslib_1 = require("tslib"); 5 | /** 6 | * Copyright 2018 Google Inc. All Rights Reserved. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | const command_line_args_1 = tslib_1.__importDefault(require("command-line-args")); 21 | const command_line_usage_1 = tslib_1.__importDefault(require("command-line-usage")); 22 | const intermock_1 = require("../lang/ts/intermock"); 23 | const read_files_1 = require("../lib/read-files"); 24 | const optionDefinitions = [ 25 | { 26 | name: 'files', 27 | alias: 'f', 28 | type: String, 29 | multiple: true, 30 | defaultOption: true 31 | }, 32 | { name: 'interfaces', alias: 'i', type: String, multiple: true }, 33 | { name: 'help', alias: 'h', type: Boolean }, 34 | { name: 'fixed', alias: 'x', type: Boolean }, 35 | { name: 'outputFormat', alias: 'o', type: String }, 36 | ]; 37 | const instructions = [ 38 | { 39 | content: 'Intermock', 40 | raw: true, 41 | }, 42 | { 43 | header: '', 44 | content: 'Generates fake data from TypeScript interfaces via Faker', 45 | }, 46 | { 47 | header: 'Options', 48 | optionList: [ 49 | { 50 | name: 'interfaces', 51 | typeLabel: 'example: --interfaces "Person" "User"', 52 | description: 'Optional list of interfaces to mock', 53 | }, 54 | { 55 | name: 'files', 56 | typeLabel: 'example: web/apps/some-directory/interfaces1.ts', 57 | description: 'Interface files to generate fake data from', 58 | }, 59 | { 60 | name: 'outputFormat', 61 | typeLabel: 'example: json', 62 | description: 'Format to use for output. Can be string, json or object', 63 | }, 64 | { 65 | name: 'help', 66 | description: 'Print this usage guide.', 67 | } 68 | ], 69 | }, 70 | ]; 71 | function isWelcomeMessageNeeded(options) { 72 | if (!options || !options.files || options.help) { 73 | return true; 74 | } 75 | return false; 76 | } 77 | function showWelcomeMessage() { 78 | const usage = command_line_usage_1.default(instructions); 79 | console.log(usage); 80 | } 81 | function main() { 82 | const options = command_line_args_1.default(optionDefinitions); 83 | if (isWelcomeMessageNeeded(options)) { 84 | showWelcomeMessage(); 85 | return; 86 | } 87 | const isFixedMode = options.fixed; 88 | const interfaces = options.interfaces; 89 | const output = options.outputFormat; 90 | return read_files_1.readFiles(options.files).then((files) => { 91 | try { 92 | const result = intermock_1.mock({ 93 | files, 94 | interfaces, 95 | isFixedMode, 96 | output, 97 | }); 98 | console.log(result); 99 | } 100 | catch (err) { 101 | console.log(err.message); 102 | } 103 | }); 104 | } 105 | main(); 106 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/cli/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;GAcG;AACH,kFAAgD;AAChD,oFAAkD;AAElD,oDAAqE;AACrE,kDAA4C;AAE5C,MAAM,iBAAiB,GAAG;IACxB;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;KACpB;IACD,EAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC;IAC9D,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC;IACzC,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC;IAC1C,EAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAC;CACjD,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB;QACE,OAAO,EAAE,WAAW;QACpB,GAAG,EAAE,IAAI;KACV;IACD;QACE,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,0DAA0D;KACpE;IACD;QACE,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,YAAY;gBAClB,SAAS,EAAE,uCAAuC;gBAClD,WAAW,EAAE,qCAAqC;aACnD;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,SAAS,EAAE,iDAAiD;gBAC5D,WAAW,EAAE,4CAA4C;aAC1D;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,SAAS,EAAE,eAAe;gBAC1B,WAAW,EAAE,yDAAyD;aACvE;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,yBAAyB;aACvC;SACF;KACF;CACF,CAAC;AAWF,SAAS,sBAAsB,CAAC,OAAgB;IAC9C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE;QAC9C,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,KAAK,GAAG,4BAAgB,CAAC,YAAY,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,IAAI;IACX,MAAM,OAAO,GAAY,2BAAe,CAAC,iBAAiB,CAAY,CAAC;IAEvE,IAAI,sBAAsB,CAAC,OAAO,CAAC,EAAE;QACnC,kBAAkB,EAAE,CAAC;QACrB,OAAO;KACR;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;IAClC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAEpC,OAAO,sBAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7C,IAAI;YACF,MAAM,MAAM,GAAG,gBAAW,CAAC;gBACzB,KAAK;gBACL,UAAU;gBACV,WAAW;gBACX,MAAM;aACP,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SACrB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { Options } from './lang/ts/intermock'; 17 | export declare function mock(options: Options): string | Record; 18 | -------------------------------------------------------------------------------- /src/intermock/build/src/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2019 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | const intermock_1 = require("./lang/ts/intermock"); 19 | function mock(options) { 20 | switch (options.language) { 21 | case 'typescript': 22 | default: 23 | return intermock_1.mock(options); 24 | } 25 | } 26 | exports.mock = mock; 27 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,mDAA4D;AAE5D,SAAgB,IAAI,CAAC,OAAgB;IACnC,QAAQ,OAAO,CAAC,QAAQ,EAAE;QACxB,KAAK,YAAY,CAAC;QAClB;YACE,OAAO,gBAAM,CAAC,OAAO,CAAC,CAAC;KAC1B;AACH,CAAC;AAND,oBAMC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lang/ts/intermock.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Intermock general options 3 | */ 4 | export interface Options { 5 | files?: Array<[string, string]>; 6 | language?: SupportedLanguage; 7 | interfaces?: string[]; 8 | isFixedMode?: boolean; 9 | output?: OutputType; 10 | isOptionalAlwaysEnabled?: boolean; 11 | count?: number; 12 | } 13 | declare type SupportedLanguage = 'typescript'; 14 | export declare type OutputType = 'object' | 'json' | 'string'; 15 | /** 16 | * Intermock API. 17 | * 18 | * Given an options object, with a files array property, Intermock parses the 19 | * AST and generates mock objects with fake data. 20 | * 21 | * This is the only part of the API exposed to a caller (including the CLI). 22 | * All data is passed through the `files` property on the options object. 23 | * 24 | * @param options Intermock general options object 25 | */ 26 | export declare function mock(options: Options): string | Record; 27 | export {}; 28 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/constants.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const DEFAULT_ARRAY_RANGE: [number, number]; 17 | export declare const FIXED_ARRAY_COUNT = 3; 18 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/constants.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * Copyright 2018 Google Inc. All Rights Reserved. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | exports.DEFAULT_ARRAY_RANGE = [1, 10]; 19 | exports.FIXED_ARRAY_COUNT = 3; 20 | //# sourceMappingURL=constants.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/constants.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;GAcG;AACU,QAAA,mBAAmB,GAAqB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAChD,QAAA,iBAAiB,GAAG,CAAC,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/default-type-to-mock.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export declare const supportedPrimitiveTypes: { 3 | [key: string]: boolean; 4 | }; 5 | export declare const defaultTypeToMock: { 6 | [index: number]: (isFixedMode: boolean) => string | number | boolean | object; 7 | }; 8 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/default-type-to-mock.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const tslib_1 = require("tslib"); 4 | /** 5 | * Copyright 2018 Google Inc. All Rights Reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | const typescript_1 = tslib_1.__importDefault(require("typescript")); 20 | const fake_1 = require("./fake"); 21 | exports.supportedPrimitiveTypes = { 22 | [typescript_1.default.SyntaxKind.NumberKeyword]: true, 23 | [typescript_1.default.SyntaxKind.StringKeyword]: true, 24 | [typescript_1.default.SyntaxKind.BooleanKeyword]: true, 25 | [typescript_1.default.SyntaxKind.ObjectKeyword]: true, 26 | [typescript_1.default.SyntaxKind.AnyKeyword]: true, 27 | }; 28 | /* tslint:disable */ 29 | exports.defaultTypeToMock = { 30 | [typescript_1.default.SyntaxKind.NumberKeyword]: (isFixedMode = false) => parseInt(fake_1.fake('random.number', isFixedMode), 10), 31 | [typescript_1.default.SyntaxKind.StringKeyword]: (isFixedMode = false) => fake_1.fake('lorem.text', isFixedMode), 32 | [typescript_1.default.SyntaxKind.BooleanKeyword]: (isFixedMode = false) => JSON.parse(fake_1.fake('random.boolean', isFixedMode)), 33 | [typescript_1.default.SyntaxKind.ObjectKeyword]: (isFixedMode = false) => { 34 | return {}; 35 | }, 36 | [typescript_1.default.SyntaxKind.AnyKeyword]: (isFixedMode = false) => '', 37 | }; 38 | /* tslint:enable */ 39 | //# sourceMappingURL=default-type-to-mock.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/default-type-to-mock.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"default-type-to-mock.js","sourceRoot":"","sources":["../../../src/lib/default-type-to-mock.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,oEAA4B;AAC5B,iCAA4B;AAEf,QAAA,uBAAuB,GAA6B;IAC/D,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,IAAI;IACnC,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,IAAI;IACnC,CAAC,oBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,IAAI;IACpC,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,IAAI;IACnC,CAAC,oBAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,IAAI;CACjC,CAAC;AAEF,oBAAoB;AACP,QAAA,iBAAiB,GAE1B;IACF,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,GAAG,KAAK,EAAE,EAAE,CACnD,QAAQ,CAAC,WAAI,CAAC,eAAe,EAAE,WAAW,CAAW,EAAE,EAAE,CAAC;IAC9D,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,GAAG,KAAK,EAAE,EAAE,CACnD,WAAI,CAAC,YAAY,EAAE,WAAW,CAAC;IACnC,CAAC,oBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC,WAAW,GAAG,KAAK,EAAE,EAAE,CACpD,IAAI,CAAC,KAAK,CAAC,WAAI,CAAC,gBAAgB,EAAE,WAAW,CAAW,CAAC;IAC7D,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,GAAG,KAAK,EAAE,EAAE;QACrD,OAAO,EAAE,CAAA;IACX,CAAC;IACD,CAAC,oBAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE;CACxD,CAAC;AACF,mBAAmB"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/fake.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Wrapper for Faker, or any mocking framework 3 | */ 4 | export declare function fake(mockType: string, isFixedMode?: boolean): string | number | boolean; 5 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/fake.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const tslib_1 = require("tslib"); 4 | /** 5 | * Copyright 2018 Google Inc. All Rights Reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | const faker_1 = tslib_1.__importDefault(require("faker")); 20 | const fixed_data_1 = require("./fixed-data"); 21 | /** 22 | * Wrapper for Faker, or any mocking framework 23 | */ 24 | function fake(mockType, isFixedMode = false) { 25 | if (isFixedMode) { 26 | return fixed_data_1.fixedData[mockType]; 27 | } 28 | return faker_1.default.fake(`{{${mockType}}}`); 29 | } 30 | exports.fake = fake; 31 | //# sourceMappingURL=fake.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/fake.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"fake.js","sourceRoot":"","sources":["../../../src/lib/fake.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,0DAA0B;AAC1B,6CAAuC;AAEvC;;GAEG;AACH,SAAgB,IAAI,CAAC,QAAgB,EAAE,WAAW,GAAG,KAAK;IACxD,IAAI,WAAW,EAAE;QACf,OAAO,sBAAS,CAAC,QAAQ,CAAC,CAAC;KAC5B;IAED,OAAO,eAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC;AACvC,CAAC;AAND,oBAMC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/fixed-data.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const fixedData: Record; 17 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/fixed-data.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"fixed-data.js","sourceRoot":"","sources":["../../../src/lib/fixed-data.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEU,QAAA,SAAS,GAA0C;IAC9D,iBAAiB,EAAE,KAAK;IACxB,cAAc,EAAE,iBAAiB;IACjC,oBAAoB,EAAE,MAAM;IAC5B,oBAAoB,EAAE,MAAM;IAC5B,oBAAoB,EAAE,eAAe;IACrC,uBAAuB,EAAE,oBAAoB;IAC7C,sBAAsB,EAAE,OAAO;IAC/B,sBAAsB,EAAE,GAAG;IAC3B,0BAA0B,EAAE,UAAU;IACtC,gBAAgB,EAAE,MAAM;IACxB,iBAAiB,EAAE,QAAQ;IAC3B,qBAAqB,EAAE,IAAI;IAC3B,eAAe,EAAE,SAAS;IAC1B,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,OAAO;IAC3B,mBAAmB,EAAE,CAAC,QAAQ;IAC9B,gBAAgB,EAAE,SAAS;IAC3B,qBAAqB,EAAE,QAAQ;IAC/B,sBAAsB,EAAE,uBAAuB;IAC/C,gBAAgB,EAAE,MAAM;IACxB,2BAA2B,EAAE,WAAW;IACxC,0BAA0B,EAAE,SAAS;IACrC,kBAAkB,EAAE,MAAM;IAC1B,kBAAkB,EAAE,wBAAwB;IAC5C,qBAAqB,EAAE,2BAA2B;IAClD,uBAAuB,EAAE,OAAO;IAChC,qBAAqB,EAAE,kCAAkC;IACzD,YAAY,EAAE,kCAAkC;IAChD,8BAA8B,EAAE,UAAU;IAC1C,+BAA+B,EAAE,aAAa;IAC9C,yBAAyB,EAAE,UAAU;IACrC,qBAAqB,EAAE,UAAU;IACjC,gBAAgB,EAAE,UAAU;IAC5B,gBAAgB,EAAE,UAAU;IAC5B,iBAAiB,EAAE,OAAO;IAC1B,eAAe,EAAE,UAAU;IAC3B,oBAAoB,EAAE,iBAAiB;IACvC,iBAAiB,EAAE,WAAW;IAC9B,WAAW,EAAE,yCAAyC;IACtD,aAAa,EAAE,yCAAyC;IACxD,cAAc,EAAE,cAAc;IAC9B,aAAa,EAAE,yCAAyC;IACxD,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,UAAU;IAC1B,iBAAiB,EAAE,QAAQ;IAC3B,qBAAqB,EAAE,sBAAsB;IAC7C,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,MAAM;IACxB,yBAAyB,EAAE,SAAS;IACpC,sBAAsB,EAAE,KAAK;IAC7B,sBAAsB,EAAE,gBAAgB;IACxC,wBAAwB,EAAE,GAAG;IAC7B,wBAAwB,EAAE,mCAAmC;IAC7D,cAAc,EAAE,wBAAwB;IACxC,aAAa,EAAE,aAAa;IAC5B,qBAAqB,EAAE,MAAM;IAC7B,kBAAkB,EAAE,SAAS;IAC7B,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,UAAU;IACzB,gBAAgB,EAAE,cAAc;IAChC,eAAe,EACX,4EAA4E;IAChF,aAAa,EAAE,oCAAoC;IACnD,cAAc,EACV,iEAAiE;IACrE,gBAAgB,EAAE,+BAA+B;IACjD,gBAAgB,EAAE,wCAAwC;IAC1D,eAAe,EAAE,uCAAuC;IACxD,gBAAgB,EAAE,wCAAwC;IAC1D,YAAY,EAAE,oCAAoC;IAClD,YAAY,EAAE,oCAAoC;IAClD,YAAY,EAAE,oCAAoC;IAClD,iBAAiB,EAAE,yCAAyC;IAC5D,eAAe,EAAE,uCAAuC;IACxD,cAAc,EAAE,sCAAsC;IACtD,cAAc,EAAE,sCAAsC;IACtD,cAAc,EAAE,sCAAsC;IACtD,gBAAgB,EAAE,wCAAwC;IAC1D,iBAAiB,EAAE,yCAAyC;IAC5D,eAAe,EACX,8bAA8b;IAClc,iBAAiB,EACb,gEAAgE;IACpE,gBAAgB,EAAE,2BAA2B;IAC7C,uBAAuB,EAAE,6BAA6B;IACtD,mBAAmB,EAAE,SAAS;IAC9B,mBAAmB,EAAE,OAAO;IAC5B,cAAc,EAAE,oBAAoB;IACpC,qBAAqB,EAAE,eAAe;IACtC,uBAAuB,EAAE,KAAK;IAC9B,qBAAqB,EAAE,OAAO;IAC9B,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,yCAAyC;IAC1D,oBAAoB,EAChB,mHAAmH;IACvH,gBAAgB,EAAE,SAAS;IAC3B,cAAc,EAAE,mBAAmB;IACnC,mBAAmB,EAAE,iBAAiB;IACtC,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,wBAAwB;IACvC,gBAAgB,EACZ,oEAAoE;IACxE,YAAY,EAAE,kBAAkB;IAChC,iBAAiB,EACb,8VAA8V;IAClW,iBAAiB,EACb,sMAAsM;IAC1M,kBAAkB,EACd,6gBAA6gB;IACjhB,YAAY,EACR,kMAAkM;IACtM,aAAa,EACT,iHAAiH;IACrH,gBAAgB,EAAE,OAAO;IACzB,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,gBAAgB;IACjC,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,MAAM;IACrB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,oCAAoC;IAClD,oBAAoB,EAAE,UAAU;IAChC,cAAc,EAAE,KAAK;IACrB,cAAc,EAAE,YAAY;IAC5B,mBAAmB,EAAE,cAAc;IACnC,yBAAyB,EAAE,cAAc;IACzC,oBAAoB,EAAE,oBAAoB;IAC1C,eAAe,EAAE,KAAK;IACtB,qBAAqB,EAAE,GAAG;IAC1B,sBAAsB,EAAE,KAAK;IAC7B,aAAa,EAAE,sCAAsC;IACrD,gBAAgB,EAAE,IAAI;IACtB,aAAa,EAAE,WAAW;IAC1B,cAAc,EAAE,oBAAoB;IACpC,cAAc,EAAE,oCAAoC;IACpD,eAAe,EAAE,KAAK;IACtB,qBAAqB,EAAE,GAAG;IAC1B,iBAAiB,EAAE,aAAa;IAChC,uBAAuB,EAAE,aAAa;IACtC,iBAAiB,EAAE,kCAAkC;IACrD,uBAAuB,EAAE,OAAO;IAChC,sBAAsB,EAAE,KAAK;IAC7B,iBAAiB,EAAE,cAAc;IACjC,gBAAgB,EAAE,MAAM;IACxB,eAAe,EAAE,OAAO;CACzB,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/generate-fixed-data.d.ts: -------------------------------------------------------------------------------- 1 | export declare function generateFixedData(): Record; 2 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/generate-fixed-data.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * Copyright 2018 Google Inc. All Rights Reserved. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | const fake_1 = require("./fake"); 19 | const generators_1 = require("./generators"); 20 | function generateFixedData() { 21 | const fixedData = {}; 22 | generators_1.generators.forEach(generator => fixedData[generator] = fake_1.fake(generator)); 23 | return fixedData; 24 | } 25 | exports.generateFixedData = generateFixedData; 26 | //# sourceMappingURL=generate-fixed-data.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/generate-fixed-data.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"generate-fixed-data.js","sourceRoot":"","sources":["../../../src/lib/generate-fixed-data.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;GAcG;AACH,iCAA4B;AAC5B,6CAAwC;AAExC,SAAgB,iBAAiB;IAC/B,MAAM,SAAS,GAA0C,EAAE,CAAC;IAC5D,uBAAU,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,WAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC;AACnB,CAAC;AAJD,8CAIC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/generators.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * All current generators of fake data provided by Faker library 18 | */ 19 | export declare const generators: string[]; 20 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/generators.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | /** 19 | * All current generators of fake data provided by Faker library 20 | */ 21 | exports.generators = [ 22 | 'address.zipCode', 23 | 'address.city', 24 | 'address.cityPrefix', 25 | 'address.citySuffix', 26 | 'address.streetName', 27 | 'address.streetAddress', 28 | 'address.streetSuffix', 29 | 'address.streetPrefix', 30 | 'address.secondaryAddress', 31 | 'address.county', 32 | 'address.country', 33 | 'address.countryCode', 34 | 'address.state', 35 | 'address.stateAbbr', 36 | 'address.latitude', 37 | 'address.longitude', 38 | 'commerce.color', 39 | 'commerce.department', 40 | 'commerce.productName', 41 | 'commerce.price', 42 | 'commerce.productAdjective', 43 | 'commerce.productMaterial', 44 | 'commerce.product', 45 | 'company.suffixes', 46 | 'company.companyName', 47 | 'company.companySuffix', 48 | 'company.catchPhrase', 49 | 'company.bs', 50 | 'company.catchPhraseAdjective', 51 | 'company.catchPhraseDescriptor', 52 | 'company.catchPhraseNoun', 53 | 'company.bsAdjective', 54 | 'company.bsBuzz', 55 | 'company.bsNoun', 56 | 'database.column', 57 | 'database.type', 58 | 'database.collation', 59 | 'database.engine', 60 | 'date.past', 61 | 'date.future', 62 | 'date.between', 63 | 'date.recent', 64 | 'date.month', 65 | 'date.weekday', 66 | 'finance.account', 67 | 'finance.accountName', 68 | 'finance.mask', 69 | 'finance.amount', 70 | 'finance.transactionType', 71 | 'finance.currencyCode', 72 | 'finance.currencyName', 73 | 'finance.currencySymbol', 74 | 'finance.bitcoinAddress', 75 | 'finance.iban', 76 | 'finance.bic', 77 | 'hacker.abbreviation', 78 | 'hacker.adjective', 79 | 'hacker.noun', 80 | 'hacker.verb', 81 | 'hacker.ingverb', 82 | 'hacker.phrase', 83 | 'image.image', 84 | 'image.avatar', 85 | 'image.imageUrl', 86 | 'image.abstract', 87 | 'image.animals', 88 | 'image.business', 89 | 'image.cats', 90 | 'image.city', 91 | 'image.food', 92 | 'image.nightlife', 93 | 'image.fashion', 94 | 'image.people', 95 | 'image.nature', 96 | 'image.sports', 97 | 'image.technics', 98 | 'image.transport', 99 | 'image.dataUri', 100 | 'internet.avatar', 101 | 'internet.email', 102 | 'internet.exampleEmail', 103 | 'internet.userName', 104 | 'internet.protocol', 105 | 'internet.url', 106 | 'internet.domainName', 107 | 'internet.domainSuffix', 108 | 'internet.domainWord', 109 | 'internet.ip', 110 | 'internet.ipv6', 111 | 'internet.userAgent', 112 | 'internet.color', 113 | 'internet.mac', 114 | 'internet.password', 115 | 'lorem.word', 116 | 'lorem.words', 117 | 'lorem.sentence', 118 | 'lorem.slug', 119 | 'lorem.sentences', 120 | 'lorem.paragraph', 121 | 'lorem.paragraphs', 122 | 'lorem.text', 123 | 'lorem.lines', 124 | 'name.firstName', 125 | 'name.lastName', 126 | 'name.findName', 127 | 'name.jobTitle', 128 | 'name.prefix', 129 | 'name.suffix', 130 | 'name.title', 131 | 'name.jobDescriptor', 132 | 'name.jobArea', 133 | 'name.jobType', 134 | 'phone.phoneNumber', 135 | 'phone.phoneNumberFormat', 136 | 'phone.phoneFormats', 137 | 'random.number', 138 | 'random.arrayElement', 139 | 'random.objectElement', 140 | 'random.uuid', 141 | 'random.boolean', 142 | 'random.word', 143 | 'random.words', 144 | 'random.image', 145 | 'random.locale', 146 | 'random.alphaNumeric', 147 | 'system.fileName', 148 | 'system.commonFileName', 149 | 'system.mimeType', 150 | 'system.commonFileType', 151 | 'system.commonFileExt', 152 | 'system.fileType', 153 | 'system.fileExt', 154 | 'system.semver', 155 | ]; 156 | //# sourceMappingURL=generators.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/generators.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../src/lib/generators.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH;;GAEG;AACU,QAAA,UAAU,GAAG;IACxB,iBAAiB;IACjB,cAAc;IACd,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,sBAAsB;IACtB,sBAAsB;IACtB,0BAA0B;IAC1B,gBAAgB;IAChB,iBAAiB;IACjB,qBAAqB;IACrB,eAAe;IACf,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,gBAAgB;IAChB,2BAA2B;IAC3B,0BAA0B;IAC1B,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,uBAAuB;IACvB,qBAAqB;IACrB,YAAY;IACZ,8BAA8B;IAC9B,+BAA+B;IAC/B,yBAAyB;IACzB,qBAAqB;IACrB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,cAAc;IACd,aAAa;IACb,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,qBAAqB;IACrB,cAAc;IACd,gBAAgB;IAChB,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IACtB,wBAAwB;IACxB,wBAAwB;IACxB,cAAc;IACd,aAAa;IACb,qBAAqB;IACrB,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,uBAAuB;IACvB,mBAAmB;IACnB,mBAAmB;IACnB,cAAc;IACd,qBAAqB;IACrB,uBAAuB;IACvB,qBAAqB;IACrB,aAAa;IACb,eAAe;IACf,oBAAoB;IACpB,gBAAgB;IAChB,cAAc;IACd,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,eAAe;IACf,aAAa;IACb,aAAa;IACb,YAAY;IACZ,oBAAoB;IACpB,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,yBAAyB;IACzB,oBAAoB;IACpB,eAAe;IACf,qBAAqB;IACrB,sBAAsB;IACtB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,iBAAiB;IACjB,uBAAuB;IACvB,sBAAsB;IACtB,iBAAiB;IACjB,gBAAgB;IAChB,eAAe;CAChB,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/random-range.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const randomRange: (min: number, max: number) => number; 17 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/random-range.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.randomRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; 19 | //# sourceMappingURL=random-range.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/random-range.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"random-range.js","sourceRoot":"","sources":["../../../src/lib/random-range.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEU,QAAA,WAAW,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE,CACpD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/read-files.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare type FileTuple = [string, string]; 17 | export declare type FileTuples = FileTuple[]; 18 | export declare function readFiles(files: string[]): Promise; 19 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/read-files.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2019 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | const tslib_1 = require("tslib"); 19 | const fs_readfile_promise_1 = tslib_1.__importDefault(require("fs-readfile-promise")); 20 | function readFiles(files) { 21 | const filePromises = files.map(file => fs_readfile_promise_1.default(file)); 22 | return new Promise((resolve) => { 23 | Promise.all(filePromises).then(buffers => { 24 | const contents = []; 25 | buffers.forEach((buffer, index) => contents.push([files[index], buffer.toString()])); 26 | resolve(contents); 27 | }); 28 | }); 29 | } 30 | exports.readFiles = readFiles; 31 | //# sourceMappingURL=read-files.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/read-files.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"read-files.js","sourceRoot":"","sources":["../../../src/lib/read-files.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sFAA2C;AAK3C,SAAgB,SAAS,CAAC,KAAe;IACvC,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,6BAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YACvC,MAAM,QAAQ,GAAe,EAAE,CAAC;YAChC,OAAO,CAAC,OAAO,CACX,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;YACzE,OAAO,CAAC,QAAsB,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,8BAUC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/smart-props.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const smartProps: { 17 | [index: string]: string; 18 | }; 19 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/smart-props.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * Copyright 2018 Google Inc. All Rights Reserved. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | exports.smartProps = { 19 | firstName: 'name.firstName', 20 | middleName: 'name.firstName', 21 | lastName: 'name.lastName', 22 | nickName: 'name.findName', 23 | name: 'name.findName', 24 | informalName: 'name.findName', 25 | phone: 'phone.phoneNumber', 26 | email: 'internet.email', 27 | primaryEmail: 'internet.email', 28 | initials: 'address.countryCode', 29 | avatarUrl: 'internet.avatar', 30 | emailAddress: 'internet.email', 31 | username: 'internet.userName', 32 | startDate: 'date.past', 33 | createdOn: 'date.past', 34 | createdAt: 'date.past', 35 | companyName: 'company.companyName', 36 | date: 'date.past', 37 | endDate: 'date.future', 38 | id: 'random.uuid', 39 | oid: 'random.uuid', 40 | }; 41 | //# sourceMappingURL=smart-props.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/smart-props.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"smart-props.js","sourceRoot":"","sources":["../../../src/lib/smart-props.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;GAcG;AACU,QAAA,UAAU,GAA8B;IACnD,SAAS,EAAE,gBAAgB;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,QAAQ,EAAE,eAAe;IACzB,QAAQ,EAAE,eAAe;IACzB,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,eAAe;IAC7B,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,gBAAgB;IACvB,YAAY,EAAE,gBAAgB;IAC9B,QAAQ,EAAE,qBAAqB;IAC/B,SAAS,EAAE,iBAAiB;IAC5B,YAAY,EAAE,gBAAgB;IAC9B,QAAQ,EAAE,mBAAmB;IAC7B,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,qBAAqB;IAClC,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,aAAa;IACtB,EAAE,EAAE,aAAa;IACjB,GAAG,EAAE,aAAa;CACnB,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/src/lib/stringify.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * Stringfy a POJO and preserve its functions. 19 | * 20 | * Courtesy of @cowboy 21 | * https://gist.github.com/cowboy/3749767 22 | * @param obj 23 | */ 24 | export declare function stringify(obj: object): string; 25 | -------------------------------------------------------------------------------- /src/intermock/build/src/lib/stringify.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | /** 19 | * Stringfy a POJO and preserve its functions. 20 | * 21 | * Courtesy of @cowboy 22 | * https://gist.github.com/cowboy/3749767 23 | * @param obj 24 | */ 25 | function stringify(obj) { 26 | const placeholder = '____PLACEHOLDER____'; 27 | const fns = []; 28 | let json = JSON.stringify(obj, (key, value) => { 29 | if (typeof value === 'function') { 30 | fns.push(value); 31 | return placeholder; 32 | } 33 | return value; 34 | }, 2); 35 | json = json.replace(new RegExp('"' + placeholder + '"', 'g'), () => { 36 | const result = fns.shift(); 37 | if (!result) { 38 | return ''; 39 | } 40 | return result; 41 | }); 42 | return json + ';'; 43 | } 44 | exports.stringify = stringify; 45 | //# sourceMappingURL=stringify.js.map -------------------------------------------------------------------------------- /src/intermock/build/src/lib/stringify.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"stringify.js","sourceRoot":"","sources":["../../../src/lib/stringify.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,GAAW;IACnC,MAAM,WAAW,GAAG,qBAAqB,CAAC;IAC1C,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;QAC5D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;YAC/B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChB,OAAO,WAAW,CAAC;SACpB;QAED,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG,WAAW,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE;QACjE,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,EAAE,CAAC;SACX;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,GAAG,GAAG,CAAC;AACpB,CAAC;AAvBD,8BAuBC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/mock.spec.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import 'mocha'; 17 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/mock.spec.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mock.spec.js","sourceRoot":"","sources":["../../../test/ts/mock.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iBAAe;AAEf,+BAA4B;AAE5B,uCAAiC;AAEjC,yDAAmD;AAEnD,yCAA4C;AAC5C,6CAAiD;AACjD,2CAA8C;AAC9C,qDAAyD;AACzD,2CAA8C;AAE9C,iDAAqD;AACrD,2CAA8C;AAC9C,yDAA4D;AAC5D,mDAAsD;AACtD,qDAAyD;AACzD,2DAAwD;AACxD,mDAA0E;AAC1E,uEAAyE;AACzE,6CAAiD;AACjD,qDAAwD;AACxD,+CAAiD;AAEjD,SAAe,WAAW,CACtB,IAAY,EAAE,UAAkB,EAAE,QAAiB,EAAE,OAAiB;;QACxE,MAAM,KAAK,GAAG,MAAM,sBAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,OAAO,CAAC,CAAC;QACzE,MAAM,MAAM,GAAG,YAAI,CAAC,SAAS,CAAuB,CAAC;QAErD,IAAI,UAAU,EAAE;YACd,aAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACpD;aAAM;YACL,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACxC;IACH,CAAC;CAAA;AAED,SAAe,SAAS,CACpB,IAAY,EAAE,OAAiB;;QACjC,MAAM,KAAK,GAAG,MAAM,sBAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,OAAO,CAAC,CAAC;QACzE,OAAO,YAAI,CAAC,SAAS,CAAuB,CAAC;IAC/C,CAAC;CAAA;AAED,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,OAAO,WAAW,CACd,GAAG,SAAS,oBAAoB,EAAE,eAAe,EAAE,mBAAY,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,OAAO,WAAW,CACd,GAAG,SAAS,wBAAwB,EAAE,YAAY,EAAE,2BAAgB,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,OAAO,WAAW,CACd,GAAG,SAAS,4BAA4B,EAAE,QAAQ,EAAE,6BAAc,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qFAAqF,EACrF,GAAG,EAAE;QACH,OAAO,WAAW,CACd,GAAG,SAAS,wBAAwB,EAAE,MAAM,EAC5C,4BAAiB,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEN,EAAE,CAAC,oFAAoF,EACpF,GAAG,EAAE;QACH,OAAO,WAAW,CACd,GAAG,SAAS,wBAAwB,EAAE,MAAM,EAAE,4BAAiB,CAAC,IAAI,EACpE,EAAC,uBAAuB,EAAE,IAAI,EAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEN,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,OAAO,WAAW,CACd,GAAG,SAAS,yBAAyB,EAAE,QAAQ,EAC/C,6BAAiB,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,OAAO,WAAW,CACd,GAAG,SAAS,yBAAyB,EAAE,QAAQ,EAC/C,6BAAiB,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,OAAO,WAAW,CACd,GAAG,SAAS,oBAAoB,EAAE,QAAQ,EAAE,mBAAY,CAAC,MAAM,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,OAAO,WAAW,CACd,GAAG,SAAS,sBAAsB,EAAE,SAAS,EAAE,sBAAa,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,OAAO,WAAW,CACd,GAAG,SAAS,sBAAsB,EAAE,QAAQ,EAAE,sBAAa,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,OAAO,WAAW,CACd,GAAG,SAAS,sBAAsB,EAAE,MAAM,EAAE,sBAAa,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,OAAO,WAAW,CACd,GAAG,SAAS,sBAAsB,EAAE,MAAM,EAAE,sBAAa,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8EAA8E,EAC9E,GAAG,EAAE;QACH,OAAO,WAAW,CACd,GAAG,SAAS,sBAAsB,EAAE,aAAa,EACjD,sBAAa,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEN,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,OAAO,WAAW,CACd,GAAG,SAAS,qBAAqB,EAAE,MAAM,EAAE,sBAAc,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,OAAO,WAAW,CACd,GAAG,SAAS,qBAAqB,EAAE,MAAM,EAAE,sBAAc,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,OAAO,WAAW,CACd,GAAG,SAAS,kCAAkC,EAAE,EAAE,EAClD,8CAAyB,EAAE,EAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,OAAO,WAAW,CAAC,GAAG,SAAS,mBAAmB,EAAE,MAAM,EAAE,iBAAW,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAS,EAAE;QAClE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,SAAS,yBAAyB,CAC1B,CAAC;QAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QAChE,MAAM,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC,oBAAoB,EAAE,CAAC;QAErE,aAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/B,aAAM,CAAC,YAAY,CAAC;aACf,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,2BAA2B,EAAC,CAAC,CAAC;IAC5E,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,GAAS,EAAE;QACpC,MAAM,MAAM,GACR,MAAM,SAAS,CAAC,GAAG,SAAS,oBAAoB,EAAE,EAAC,MAAM,EAAE,MAAM,EAAC,CAC5D,CAAC;QAEX,aAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAY,CAAC,CAAC,CAAC;IACrE,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;QACnD,OAAO,WAAW,CACd,GAAG,SAAS,yBAAyB,EAAE,YAAY,EACnD,8BAAkB,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,OAAO,WAAW,CACd,GAAG,SAAS,yBAAyB,EAAE,QAAQ,EAC/C,8BAAkB,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,OAAO,WAAW,CACd,GAAG,SAAS,2BAA2B,EAAE,QAAQ,EACjD,iCAAmB,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAS,EAAE;QAClE,OAAO,WAAW,CACd,GAAG,SAAS,uBAAuB,EAAE,QAAQ,EAAE,0BAAgB,CAAC,MAAM,CAAC,CAAC;IAC9E,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/stringify.spec.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import 'mocha'; 17 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/stringify.spec.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | "use strict"; 3 | /** 4 | * Copyright 2018 Google Inc. All Rights Reserved. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | Object.defineProperty(exports, "__esModule", { value: true }); 19 | require("mocha"); 20 | const chai_1 = require("chai"); 21 | const stringify_1 = require("../../src/lib/stringify"); 22 | describe('Stringify tests', () => { 23 | it('should stringify object with functions', () => { 24 | const obj = { 25 | foo: () => 'blah', 26 | bar: () => () => 42, 27 | baz: 3.14, 28 | }; 29 | const result = stringify_1.stringify(obj).trim(); 30 | const expectation = `{\n "foo": () => \'blah\',\n "bar": () => () => 42,\n "baz": 3.14\n};` 31 | .trim(); 32 | chai_1.expect(result).to.eq(expectation); 33 | }); 34 | }); 35 | //# sourceMappingURL=stringify.spec.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/stringify.spec.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"stringify.spec.js","sourceRoot":"","sources":["../../../test/ts/stringify.spec.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG;;AAEH,iBAAe;AAEf,+BAA4B;AAC5B,uDAAkD;AAElD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,GAAG,GAAG;YACV,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM;YACjB,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE;YACnB,GAAG,EAAE,IAAI;SACV,CAAC;QAEF,MAAM,MAAM,GAAG,qBAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACrC,MAAM,WAAW,GACb,0EAA0E;aACrE,IAAI,EAAE,CAAC;QAChB,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/any.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export interface User { 17 | firstName: string; 18 | lastName: string; 19 | stats: any; 20 | } 21 | export declare const expectedAny: { 22 | firstName: string; 23 | lastName: string; 24 | stats: string; 25 | }; 26 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/any.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.expectedAny = { 19 | firstName: 'Mabel', 20 | lastName: 'Williamson', 21 | stats: '' 22 | }; 23 | //# sourceMappingURL=any.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/any.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"any.js","sourceRoot":"","sources":["../../../../test/ts/test-data/any.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAUU,QAAA,WAAW,GAAG;IACzB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,YAAY;IACtB,KAAK,EAAE,EAAE;CACV,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/array.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const expectedArray1: { 17 | Order: { 18 | id: string; 19 | name: string; 20 | }; 21 | User: { 22 | orders: { 23 | id: string; 24 | name: string; 25 | }[]; 26 | moreOrders: { 27 | id: string; 28 | name: string; 29 | }[]; 30 | finalOrders: { 31 | id: string; 32 | name: string; 33 | }[]; 34 | bestFriends: string[]; 35 | }; 36 | }; 37 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/array.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.expectedArray1 = { 19 | 'Order': { 20 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 21 | 'name': 'consequuntur ab fugiat' 22 | }, 23 | 'User': { 24 | 'orders': [ 25 | { 26 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 27 | 'name': 'consequuntur ab fugiat' 28 | }, 29 | { 30 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 31 | 'name': 'consequuntur ab fugiat' 32 | }, 33 | { 34 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 35 | 'name': 'consequuntur ab fugiat' 36 | } 37 | ], 38 | 'moreOrders': [ 39 | { 40 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 41 | 'name': 'consequuntur ab fugiat' 42 | }, 43 | { 44 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 45 | 'name': 'consequuntur ab fugiat' 46 | }, 47 | { 48 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 49 | 'name': 'consequuntur ab fugiat' 50 | } 51 | ], 52 | 'finalOrders': [ 53 | { 54 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 55 | 'name': 'consequuntur ab fugiat' 56 | }, 57 | { 58 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 59 | 'name': 'consequuntur ab fugiat' 60 | }, 61 | { 62 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 63 | 'name': 'consequuntur ab fugiat' 64 | } 65 | ], 66 | 'bestFriends': [ 67 | 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.', 68 | 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.', 69 | 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.' 70 | ] 71 | } 72 | }; 73 | //# sourceMappingURL=array.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/array.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"array.js","sourceRoot":"","sources":["../../../../test/ts/test-data/array.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAoBU,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,IAAI,EAAE,sCAAsC;QAC5C,MAAM,EAAE,wBAAwB;KACjC;IACD,MAAM,EAAE;QACN,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;YACD;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;YACD;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;SACF;QACD,YAAY,EAAE;YACZ;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;YACD;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;YACD;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;SACF;QACD,aAAa,EAAE;YACb;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;YACD;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;YACD;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,wBAAwB;aACjC;SACF;QACD,aAAa,EAAE;YACb,kMAAkM;YAClM,kMAAkM;YAClM,kMAAkM;SACnM;KAEF;CACF,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/enum.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const expectedEnum: { 17 | Person: { 18 | name: string; 19 | status: number; 20 | favoriteNumber: number; 21 | favoriteMusicians: string; 22 | favoriteNovel: number; 23 | }; 24 | }; 25 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/enum.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | var GreatMusicians; 19 | (function (GreatMusicians) { 20 | GreatMusicians["mozart"] = "Mozart"; 21 | GreatMusicians["beethoven"] = "Beethoven"; 22 | })(GreatMusicians || (GreatMusicians = {})); 23 | var GreatNovels; 24 | (function (GreatNovels) { 25 | GreatNovels[GreatNovels["MOBY_DICK"] = 0] = "MOBY_DICK"; 26 | GreatNovels[GreatNovels["GRAPES_OF_WRATH"] = 1] = "GRAPES_OF_WRATH"; 27 | GreatNovels[GreatNovels["SLAUGHTERHOUSE_FIVE"] = 2] = "SLAUGHTERHOUSE_FIVE"; 28 | })(GreatNovels || (GreatNovels = {})); 29 | var Awesomeness; 30 | (function (Awesomeness) { 31 | Awesomeness[Awesomeness["COOL"] = 0] = "COOL"; 32 | Awesomeness[Awesomeness["LAME"] = 1] = "LAME"; 33 | })(Awesomeness || (Awesomeness = {})); 34 | var GreatNumbers; 35 | (function (GreatNumbers) { 36 | GreatNumbers[GreatNumbers["e"] = 2.71] = "e"; 37 | GreatNumbers[GreatNumbers["pi"] = 3.14] = "pi"; 38 | GreatNumbers[GreatNumbers["golden"] = 1.61] = "golden"; 39 | })(GreatNumbers || (GreatNumbers = {})); 40 | exports.expectedEnum = { 41 | Person: { 42 | name: 'Natasha Jacobs', 43 | status: 1, 44 | favoriteNumber: 3.14, 45 | favoriteMusicians: 'Beethoven', 46 | favoriteNovel: 1 47 | } 48 | }; 49 | //# sourceMappingURL=enum.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/enum.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../../test/ts/test-data/enum.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAIH,IAAK,cAGJ;AAHD,WAAK,cAAc;IACjB,mCAAiB,CAAA;IACjB,yCAAuB,CAAA;AACzB,CAAC,EAHI,cAAc,KAAd,cAAc,QAGlB;AAED,IAAK,WAIJ;AAJD,WAAK,WAAW;IACd,uDAAS,CAAA;IACT,mEAAe,CAAA;IACf,2EAAmB,CAAA;AACrB,CAAC,EAJI,WAAW,KAAX,WAAW,QAIf;AACD,IAAK,WAGJ;AAHD,WAAK,WAAW;IACd,6CAAI,CAAA;IACJ,6CAAI,CAAA;AACN,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AACD,IAAK,YAIJ;AAJD,WAAK,YAAY;IACf,4CAAQ,CAAA;IACR,8CAAS,CAAA;IACT,sDAAa,CAAA;AACf,CAAC,EAJI,YAAY,KAAZ,YAAY,QAIhB;AAUY,QAAA,YAAY,GAAG;IAC1B,MAAM,EAAE;QACN,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,CAAC;QACT,cAAc,EAAE,IAAI;QACpB,iBAAiB,EAAE,WAAW;QAC9B,aAAa,EAAE,CAAC;KACjB;CACF,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/extension.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const expectedContractor: { 17 | Contractor: { 18 | employmentAgency: string; 19 | username: string; 20 | isActive: boolean; 21 | startDate: string; 22 | endDate: string; 23 | background: { 24 | school: string; 25 | }; 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/extension.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.expectedContractor = { 19 | Contractor: { 20 | employmentAgency: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.', 21 | username: 'Jakob10', 22 | isActive: true, 23 | startDate: 'Thu Dec 28 2017 20:44:18 GMT-0800 (PST)', 24 | endDate: 'Sun Apr 28 2019 23:50:14 GMT-0700 (PDT)', 25 | background: { 26 | school: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.' 27 | } 28 | } 29 | }; 30 | //# sourceMappingURL=extension.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/extension.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../../test/ts/test-data/extension.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAyBU,QAAA,kBAAkB,GAAG;IAChC,UAAU,EAAE;QACV,gBAAgB,EACZ,kMAAkM;QACtM,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,yCAAyC;QACpD,OAAO,EAAE,yCAAyC;QAClD,UAAU,EAAE;YACV,MAAM,EACF,kMAAkM;SACvM;KACF;CACF,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/flat.d.ts: -------------------------------------------------------------------------------- 1 | export declare const expectedFlat: { 2 | name: string; 3 | age: number; 4 | isCool: boolean; 5 | type: string; 6 | id: number; 7 | wantsFries: boolean; 8 | wantsChocolate: boolean; 9 | }; 10 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/flat.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.expectedFlat = { 4 | name: 'Natasha Jacobs', 5 | age: 86924, 6 | isCool: true, 7 | type: 'person', 8 | id: 5, 9 | wantsFries: true, 10 | wantsChocolate: false, 11 | }; 12 | //# sourceMappingURL=flat.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/flat.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"flat.js","sourceRoot":"","sources":["../../../../test/ts/test-data/flat.ts"],"names":[],"mappings":";;AAyBa,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,gBAAgB;IACtB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,QAAQ;IACd,EAAE,EAAE,CAAC;IACL,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,KAAK;CACtB,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | interface User { 17 | name: string; 18 | email: string; 19 | } 20 | export interface FunctionInterface { 21 | basicFunctionRetNum: () => number; 22 | functionRetInterface: () => User; 23 | } 24 | export {}; 25 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/functions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | //# sourceMappingURL=functions.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/functions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../test/ts/test-data/functions.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/generic.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare type Maybe = T | null; 17 | export interface Person { 18 | name: Maybe; 19 | isActive: boolean; 20 | } 21 | export declare const expectedGenerics: { 22 | Person: { 23 | name: string; 24 | isActive: boolean; 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/generic.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.expectedGenerics = { 19 | Person: { name: 'Natasha Jacobs', isActive: true } 20 | }; 21 | //# sourceMappingURL=generic.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/generic.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../../test/ts/test-data/generic.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AASU,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAC;CACjD,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/json.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const expectedJson = "\n{\"Person\":{\"firstName\":\"Mabel\",\"lastName\":\"Williamson\",\"phone\":\"845.046.3789\",\"nickname\":\"Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.\",\"employeeDetail\":{\"email\":\"Myron_Olson39@hotmail.com\",\"isFullTime\":true}},\"EmployeeDetail\":{\"email\":\"Myron_Olson39@hotmail.com\",\"isFullTime\":true}}\n"; 17 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/json.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.expectedJson = ` 19 | {"Person":{"firstName":"Mabel","lastName":"Williamson","phone":"845.046.3789","nickname":"Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.","employeeDetail":{"email":"Myron_Olson39@hotmail.com","isFullTime":true}},"EmployeeDetail":{"email":"Myron_Olson39@hotmail.com","isFullTime":true}} 20 | `; 21 | //# sourceMappingURL=json.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/json.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../test/ts/test-data/json.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAgBU,QAAA,YAAY,GAAG;;CAE3B,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/mappedTypes.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | declare type Scalars = { 17 | ID: string; 18 | String: string; 19 | Boolean: boolean; 20 | Int: number; 21 | Float: number; 22 | }; 23 | declare type Name = string; 24 | declare type Age = { 25 | birthday: string; 26 | }; 27 | export interface Person { 28 | name: Name; 29 | age: Age; 30 | /** @mockType {lorem.words} */ 31 | id: Scalars['ID']; 32 | isActive: Scalars['Boolean']; 33 | } 34 | export declare const expectedMappedTypes: { 35 | Person: { 36 | id: string; 37 | isActive: boolean; 38 | name: string; 39 | age: { 40 | birthday: string; 41 | }; 42 | }; 43 | }; 44 | export {}; 45 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/mappedTypes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.expectedMappedTypes = { 19 | Person: { 20 | id: 'consequuntur ab fugiat', 21 | isActive: true, 22 | name: 'Natasha Jacobs', 23 | age: { 24 | birthday: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.' 25 | } 26 | } 27 | }; 28 | //# sourceMappingURL=mappedTypes.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/mappedTypes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mappedTypes.js","sourceRoot":"","sources":["../../../../test/ts/test-data/mappedTypes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAiBU,QAAA,mBAAmB,GAAG;IACjC,MAAM,EAAE;QACN,EAAE,EAAE,wBAAwB;QAC5B,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE;YACH,QAAQ,EACJ,kMAAkM;SACvM;KACF;CACF,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/mockType.d.ts: -------------------------------------------------------------------------------- 1 | export declare const expectedMockType: { 2 | fn: string; 3 | ln: string; 4 | }; 5 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/mockType.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.expectedMockType = { 4 | fn: 'Mabel', 5 | ln: 'Williamson' 6 | }; 7 | //# sourceMappingURL=mockType.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/mockType.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mockType.js","sourceRoot":"","sources":["../../../../test/ts/test-data/mockType.ts"],"names":[],"mappings":";;AAuBa,QAAA,gBAAgB,GAAG;IAC9B,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,YAAY;CACjB,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/namespace.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const expectedNamespaced: { 17 | Person: { 18 | name: string; 19 | status: number; 20 | favoriteNumber: number; 21 | favoriteMusicians: string; 22 | favoriteNovel: number; 23 | }; 24 | }; 25 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/namespace.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | var GreatMusicians; 19 | (function (GreatMusicians) { 20 | GreatMusicians["mozart"] = "Mozart"; 21 | GreatMusicians["beethoven"] = "Beethoven"; 22 | })(GreatMusicians || (GreatMusicians = {})); 23 | var GreatNovels; 24 | (function (GreatNovels) { 25 | GreatNovels[GreatNovels["MOBY_DICK"] = 0] = "MOBY_DICK"; 26 | GreatNovels[GreatNovels["GRAPES_OF_WRATH"] = 1] = "GRAPES_OF_WRATH"; 27 | GreatNovels[GreatNovels["SLAUGHTERHOUSE_FIVE"] = 2] = "SLAUGHTERHOUSE_FIVE"; 28 | })(GreatNovels || (GreatNovels = {})); 29 | exports.expectedNamespaced = { 30 | Person: { 31 | name: 'Natasha Jacobs', 32 | status: 1, 33 | favoriteNumber: 3.14, 34 | favoriteMusicians: 'Beethoven', 35 | favoriteNovel: 1 36 | } 37 | }; 38 | //# sourceMappingURL=namespace.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/namespace.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../../test/ts/test-data/namespace.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAQH,IAAK,cAGJ;AAHD,WAAK,cAAc;IACjB,mCAAiB,CAAA;IACjB,yCAAuB,CAAA;AACzB,CAAC,EAHI,cAAc,KAAd,cAAc,QAGlB;AAED,IAAK,WAIJ;AAJD,WAAK,WAAW;IACd,uDAAS,CAAA;IACT,mEAAe,CAAA;IACf,2EAAmB,CAAA;AACrB,CAAC,EAJI,WAAW,KAAX,WAAW,QAIf;AAUY,QAAA,kBAAkB,GAAG;IAChC,MAAM,EAAE;QACN,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,CAAC;QACT,cAAc,EAAE,IAAI;QACpB,iBAAiB,EAAE,WAAW;QAC9B,aAAa,EAAE,CAAC;KACjB;CACF,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/nestedSingle.d.ts: -------------------------------------------------------------------------------- 1 | export declare const expectedNested: { 2 | firstName: string; 3 | lastName: string; 4 | phone: string; 5 | nickname: string; 6 | employeeDetail: { 7 | email: string; 8 | isFullTime: boolean; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/nestedSingle.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.expectedNested = { 4 | firstName: 'Mabel', 5 | lastName: 'Williamson', 6 | phone: '845.046.3789', 7 | nickname: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.', 8 | employeeDetail: { email: 'Myron_Olson39@hotmail.com', isFullTime: true } 9 | }; 10 | //# sourceMappingURL=nestedSingle.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/nestedSingle.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"nestedSingle.js","sourceRoot":"","sources":["../../../../test/ts/test-data/nestedSingle.ts"],"names":[],"mappings":";;AAkCa,QAAA,cAAc,GAAG;IAC5B,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,YAAY;IACtB,KAAK,EAAE,cAAc;IACrB,QAAQ,EACJ,kMAAkM;IACtM,cAAc,EAAE,EAAC,KAAK,EAAE,2BAA2B,EAAE,UAAU,EAAE,IAAI,EAAC;CACvE,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/optional.d.ts: -------------------------------------------------------------------------------- 1 | export declare const expectedOptional1: { 2 | User: { 3 | username: string; 4 | firstName: string; 5 | lastName: string; 6 | }; 7 | }; 8 | export declare const expectedOptional2: { 9 | User: { 10 | username: string; 11 | firstName: string; 12 | middleName: string; 13 | lastName: string; 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/optional.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.expectedOptional1 = { 4 | User: { username: 'Jakob10', firstName: 'Mabel', lastName: 'Williamson' } 5 | }; 6 | exports.expectedOptional2 = { 7 | User: { 8 | username: 'Jakob10', 9 | firstName: 'Mabel', 10 | middleName: 'Mabel', 11 | lastName: 'Williamson' 12 | } 13 | }; 14 | //# sourceMappingURL=optional.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/optional.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../../test/ts/test-data/optional.ts"],"names":[],"mappings":";;AAsBa,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC;CACxE,CAAC;AAGW,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,OAAO;QACnB,QAAQ,EAAE,YAAY;KACvB;CACF,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/specificInterfaces.d.ts: -------------------------------------------------------------------------------- 1 | export declare const expectedSpecificInterface: { 2 | User: { 3 | name: string; 4 | }; 5 | Person: { 6 | age: number; 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/specificInterfaces.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.expectedSpecificInterface = { 4 | 'User': { 'name': 'Natasha Jacobs' }, 5 | 'Person': { 'age': 86924 } 6 | }; 7 | //# sourceMappingURL=specificInterfaces.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/specificInterfaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"specificInterfaces.js","sourceRoot":"","sources":["../../../../test/ts/test-data/specificInterfaces.ts"],"names":[],"mappings":";;AA2Ba,QAAA,yBAAyB,GAAG;IACvC,MAAM,EAAE,EAAC,MAAM,EAAE,gBAAgB,EAAC;IAClC,QAAQ,EAAE,EAAC,KAAK,EAAE,KAAK,EAAC;CACzB,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/tuple.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | export declare const expectedTuple1: { 17 | Order: { 18 | id: string; 19 | name: string; 20 | }; 21 | Test: { 22 | pattern1: { 23 | id: string; 24 | name: string; 25 | }[]; 26 | pattern2: { 27 | id: string; 28 | name: string; 29 | }[]; 30 | pattern3: (string | number | boolean | { 31 | id: string; 32 | name: string; 33 | } | (number | boolean)[])[]; 34 | }; 35 | }; 36 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/tuple.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Copyright 2018 Google Inc. All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | const sampleOrderData = { 19 | 'id': 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 20 | 'name': 'consequuntur ab fugiat' 21 | }; 22 | exports.expectedTuple1 = { 23 | 'Order': sampleOrderData, 24 | 'Test': { 25 | 'pattern1': [sampleOrderData, sampleOrderData], 26 | 'pattern2': [ 27 | sampleOrderData, sampleOrderData, sampleOrderData, sampleOrderData, 28 | sampleOrderData 29 | ], 30 | 'pattern3': [ 31 | 86924, sampleOrderData, [false, 4649, 3939, true], 32 | 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.', 33 | 'hello world', 123.456, true, false, 86924, 86924, 86924 34 | ] 35 | } 36 | }; 37 | //# sourceMappingURL=tuple.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/tuple.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../../../test/ts/test-data/tuple.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAkBH,MAAM,eAAe,GAAG;IACtB,IAAI,EAAE,sCAAsC;IAC5C,MAAM,EAAE,wBAAwB;CACjC,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE;QACN,UAAU,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;QAC9C,UAAU,EAAE;YACV,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe;YAClE,eAAe;SAChB;QACD,UAAU,EAAE;YACV,KAAK,EAAE,eAAe,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;YACjD,kMAAkM;YAClM,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;SACzD;KACF;CACF,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/typeAlias.d.ts: -------------------------------------------------------------------------------- 1 | export declare const expectedTypeAlias: { 2 | Person: { 3 | name: string; 4 | indirection: string; 5 | detail: { 6 | phone: string; 7 | }; 8 | }; 9 | Detail: { 10 | phone: string; 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/typeAlias.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.expectedTypeAlias = { 4 | Person: { 5 | name: 'Natasha Jacobs', 6 | indirection: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.', 7 | detail: { 8 | phone: '845.046.3789', 9 | } 10 | }, 11 | Detail: { phone: '845.046.3789' } 12 | }; 13 | //# sourceMappingURL=typeAlias.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/typeAlias.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"typeAlias.js","sourceRoot":"","sources":["../../../../test/ts/test-data/typeAlias.ts"],"names":[],"mappings":";;AA2Ba,QAAA,iBAAiB,GAAG;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACP,kMAAkM;QACtM,MAAM,EAAE;YACN,KAAK,EAAE,cAAc;SACtB;KACF;IACD,MAAM,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;CAChC,CAAC"} -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/unions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | interface Dog { 17 | name: string; 18 | owner: string; 19 | } 20 | export interface LonelyHuman { 21 | name: string; 22 | bestFriend: Dog | null; 23 | } 24 | export declare const expectedUnion: { 25 | Person: { 26 | name: string; 27 | age: number; 28 | bestFriend: { 29 | name: string; 30 | owner: string; 31 | }; 32 | }; 33 | Pack: { 34 | id: string; 35 | dogs: { 36 | name: string; 37 | owner: string; 38 | }[]; 39 | }; 40 | Account: { 41 | id: string; 42 | lastDeposit: number; 43 | }; 44 | LonelyHuman: { 45 | name: string; 46 | }; 47 | Book: { 48 | title: string; 49 | color: string; 50 | }; 51 | }; 52 | export {}; 53 | -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/unions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // TODO: test union with 4 | // functions: currently I don't know how to make a Union for functions (if the 5 | // first union option is a function, then the `|` character gets applied to the 6 | // return type) 7 | exports.expectedUnion = { 8 | Person: { 9 | name: 'Natasha Jacobs', 10 | age: 86924, 11 | bestFriend: { 12 | name: 'Natasha Jacobs', 13 | owner: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.' 14 | } 15 | }, 16 | Pack: { 17 | id: 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 18 | dogs: [ 19 | { 20 | name: 'Natasha Jacobs', 21 | owner: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.' 22 | }, 23 | { 24 | name: 'Natasha Jacobs', 25 | owner: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.' 26 | }, 27 | { 28 | name: 'Natasha Jacobs', 29 | owner: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.' 30 | } 31 | ] 32 | }, 33 | Account: { 34 | id: 'bfc8cb62-c6ce-4194-a2a5-499320b837eb', 35 | lastDeposit: 86924, 36 | }, 37 | LonelyHuman: { 38 | name: 'Natasha Jacobs', 39 | }, 40 | Book: { 41 | title: 'Animi repellat eveniet eveniet dolores quo ullam rerum reiciendis ipsam. Corrupti voluptatem ipsa illum veritatis eligendi sit autem ut quia. Ea sint voluptas impedit ducimus dolores possimus.', 42 | color: 'red' 43 | } 44 | }; 45 | //# sourceMappingURL=unions.js.map -------------------------------------------------------------------------------- /src/intermock/build/test/ts/test-data/unions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"unions.js","sourceRoot":"","sources":["../../../../test/ts/test-data/unions.ts"],"names":[],"mappings":";;AAoDA,wBAAwB;AACxB,8EAA8E;AAC9E,+EAA+E;AAC/E,eAAe;AAEF,QAAA,aAAa,GAAG;IAC3B,MAAM,EAAE;QACN,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,KAAK;QACV,UAAU,EAAE;YACV,IAAI,EAAE,gBAAgB;YACtB,KAAK,EACD,kMAAkM;SACvM;KACF;IACD,IAAI,EAAE;QACJ,EAAE,EAAE,sCAAsC;QAC1C,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE,gBAAgB;gBACtB,KAAK,EACD,kMAAkM;aACvM;YACD;gBACE,IAAI,EAAE,gBAAgB;gBACtB,KAAK,EACD,kMAAkM;aACvM;YACD;gBACE,IAAI,EAAE,gBAAgB;gBACtB,KAAK,EACD,kMAAkM;aACvM;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE,EAAE,sCAAsC;QAC1C,WAAW,EAAE,KAAK;KACnB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,gBAAgB;KACvB;IACD,IAAI,EAAE;QACJ,KAAK,EACD,kMAAkM;QACtM,KAAK,EAAE,KAAK;KACb;CACF,CAAC"} -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../dist/src", 5 | "baseUrl": "", 6 | "types": [ "node" ], 7 | "typeRoots": ["../node_modules/@types"] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } -------------------------------------------------------------------------------- /src/utils/globals.ts: -------------------------------------------------------------------------------- 1 | import { Mode } from "../generators/Mode"; 2 | import { Code } from "./code"; 3 | 4 | /** 5 | * Globals to communicate accross the test environment. 6 | */ 7 | export class Globals { 8 | static isTest = false; 9 | static codeUtil: Code; 10 | 11 | static literals: string[] = []; 12 | static methodCount = 0; 13 | static mode: Mode = Mode.Falsy; 14 | 15 | static instances: { 16 | [key: string]: { 17 | [key: string]: { 18 | instances: any[] 19 | } 20 | } 21 | } = {}; 22 | static isLoading = false; 23 | } -------------------------------------------------------------------------------- /src/utils/limits.ts: -------------------------------------------------------------------------------- 1 | export class Limits { 2 | int: { min?: number, max?: number }; 3 | float: { min?: number, max?: number }; 4 | date: { min?: number, max?: number }; 5 | string: { min?: number, max?: number }; 6 | array: { min?: number, max?: number }; 7 | 8 | constructor(init: Partial) { 9 | // Fill in every argument. 10 | const arg: Partial = {}; 11 | for (const key in init) { 12 | const argValue: { min?: number, max?: number } = {}; 13 | Object.assign(argValue, Limits.defaults[key]); 14 | 15 | if (init[key].min !== undefined) { 16 | argValue.min = init[key].min; 17 | } 18 | if (init[key].max !== undefined) { 19 | argValue.max = init[key].max; 20 | } 21 | 22 | // Set any limits that are invalid if they are negative. 23 | if ( 24 | key === 'date' || 25 | key === 'string' || 26 | key === 'array' 27 | ) { 28 | argValue.min = Math.max(argValue.min, 0); 29 | } 30 | 31 | // Sanity check for max less than the default min. 32 | // Update with a sensible max if it is not set. 33 | // The date is a special case where the value is absolute. 34 | if (key !== 'date' && argValue.max <= argValue.min) { 35 | argValue.max = argValue.min + Limits.defaults[key].max; 36 | } else if (key === 'date' && argValue.max <= argValue.min) { 37 | argValue.max = argValue.min + 8.64e+7; 38 | } 39 | 40 | // Copy the limit to the partial keys. 41 | arg[key] = argValue; 42 | } 43 | 44 | // Fill in any keys not in the partial keys. 45 | Object.assign(this, Limits.defaults, arg); 46 | } 47 | 48 | private static defaults: { 49 | int: { min: number, max: number }, 50 | float: { min: number, max: number }, 51 | date: { min: number, max: number }, 52 | string: { min: number, max: number }, 53 | array: { min: number, max: number } 54 | } = { 55 | int: { min: -25, max: 25 }, 56 | float: { min: -10, max: 10 }, 57 | date: { min: Date.now() - 8.64e+7, max: Date.now() + 8.64e+7 }, 58 | string: { min: 1, max: 4 }, 59 | array: { min: 0, max: 3 } 60 | }; 61 | } -------------------------------------------------------------------------------- /src/utils/modules.ts: -------------------------------------------------------------------------------- 1 | import { GeneratorType } from "../generators/GeneratorType"; 2 | import { IGenerator } from "../generators/IGenerator"; 3 | import { MethodArg } from "./decorators"; 4 | 5 | export class ModuleMethod { 6 | name: string; 7 | className?: string; 8 | namespaces: string[]; 9 | // Doesn't need to waste memory when it's externally managed. 10 | // Usually throws property not in use for the class. 11 | // file: string; 12 | isAbstract: boolean; 13 | isAsync: boolean; 14 | isStatic: boolean; 15 | args: string[]; 16 | literals: string[]; 17 | 18 | IArgs: [string, string]; 19 | 20 | test: TestMethod; 21 | 22 | constructor(init: Partial) { 23 | Object.assign(this, init); 24 | } 25 | } 26 | 27 | export class TestMethod { 28 | args: MethodArg[]; 29 | isStart: boolean; 30 | 31 | generators: IGenerator[]; 32 | typeGenerators: GeneratorType[]; 33 | 34 | // Storage for the method run args. 35 | callArgs?: any[]; 36 | // Storage for the method run arg types. 37 | callArgsTypes?: { 38 | index: number, 39 | dimension: number, 40 | types: ModuleType[] 41 | }[]; 42 | // Storage for the constructed instance. 43 | instance?: any; 44 | // Storage for the instance type. 45 | instanceType?: ModuleType; 46 | } 47 | 48 | export class ModuleType { 49 | name: string; 50 | namespaces: string[]; 51 | file: string; 52 | kind: 'interface' | 'class' | 'enum'; 53 | isAbstract?: boolean; 54 | inherits: [string, string][]; 55 | 56 | extends?: ModuleType[]; 57 | 58 | constructor(init: ModuleType) { 59 | Object.assign(this, init); 60 | } 61 | } -------------------------------------------------------------------------------- /test/builtinsArray.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Builtin array generators with default values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Builtins'); 9 | }); 10 | 11 | it('Generates boolean values.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'builtin_bool_array'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(7); 17 | }); 18 | 19 | it('Generates integer values.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'builtin_int_array'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(15); 25 | }); 26 | 27 | it('Generates number values.', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'builtin_float_array'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(19); 33 | }); 34 | 35 | it('Generates date values.', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'builtin_date_array'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.greaterThanOrEqual(16); 41 | }); 42 | 43 | it('Generates string values.', async () => { 44 | const results: any[] = global.fastFuzzResults; 45 | 46 | const method = results.find((result: any) => result.name === 'builtin_string_array'); 47 | expect(method).to.not.equal(undefined); 48 | expect(method.results.length).to.equal(10); 49 | }); 50 | }); -------------------------------------------------------------------------------- /test/builtinsDefault.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Builtin generators with default values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Builtins'); 9 | }); 10 | 11 | it('Generates boolean values.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'builtin_bool_default'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(4); 17 | }); 18 | 19 | it('Generates integer values.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'builtin_int_default'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(12); 25 | }); 26 | 27 | it('Generates number values.', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'builtin_float_default'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(16); 33 | }); 34 | 35 | it('Generates date values.', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'builtin_date_default'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.greaterThanOrEqual(13); 41 | }); 42 | 43 | it('Generates string values.', async () => { 44 | const results: any[] = global.fastFuzzResults; 45 | 46 | const method = results.find((result: any) => result.name === 'builtin_string_default'); 47 | expect(method).to.not.equal(undefined); 48 | expect(method.results.length).to.equal(7); 49 | }); 50 | }); -------------------------------------------------------------------------------- /test/builtinsLimit.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Builtin generators with limited values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Builtins'); 9 | }); 10 | 11 | it('Generates integer values.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'builtin_int_limit'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(12); 17 | }); 18 | 19 | it('Generates number values.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'builtin_float_limit'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(16); 25 | }); 26 | 27 | it('Generates date values.', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'builtin_date_limit'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.greaterThanOrEqual(13); 33 | }); 34 | 35 | it('Generates string values.', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'builtin_string_limit'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.equal(7); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/enumArray.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Enum array generators with numeric values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Enum'); 9 | }); 10 | 11 | it('Generates default values.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'enum_num_array'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(20); 17 | }); 18 | }); -------------------------------------------------------------------------------- /test/enumDict.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Enum generators with dictionary values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Enum'); 9 | }); 10 | 11 | it('Generates broken numeric series.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'enum_dict_num'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(17); 17 | }); 18 | 19 | it('Generates single string value.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'enum_dict_mix'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(17); 25 | }); 26 | 27 | it('Generates broken numeric series and string value.', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'enum_dict_mix_num'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(17); 33 | }); 34 | 35 | it('Generates autoincrement and string value.', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'enum_dict_mix_auto'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.equal(18); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/enumNum.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Enum generators with numeric values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Enum'); 9 | }); 10 | 11 | it('Generates default values.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'enum_num_default'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(17); 17 | }); 18 | 19 | it('Generates autoincrement values.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'enum_num_auto'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(18); 25 | }); 26 | }); -------------------------------------------------------------------------------- /test/guidedInstance.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Guided instance methods.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Guided'); 9 | }); 10 | 11 | it('Fuzz simple method instance', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'guided_instance_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(3); 17 | }); 18 | 19 | it('Fuzz regular method instance', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'guided_instance_regular'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(6); 25 | }); 26 | 27 | it('Fuzz async interface instance', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'guided_instance_IAsync'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(6); 33 | }); 34 | 35 | it('Fuzz async method instance', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'guided_instance_async'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.greaterThanOrEqual(4); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/guidedStatic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Guided static methods.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Guided'); 9 | }); 10 | 11 | it('Fuzz simple method static', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'guided_static_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(3); 17 | }); 18 | 19 | it('Fuzz regular method static', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'guided_static_regular'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(6); 25 | }); 26 | 27 | it('Fuzz async interface static', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'guided_static_IAsync'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(6); 33 | }); 34 | 35 | it('Fuzz async method static', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'guided_static_async'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.be.greaterThanOrEqual(4); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/naked.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Naked generators with simple values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Naked', 90e3); 9 | }); 10 | 11 | it('Generates single buillt-in argument for non-decorated method.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'naked_static'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.be.greaterThanOrEqual(2); 17 | }); 18 | 19 | it('Generates single instance of type with non-decorated method.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'naked_instance'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.be.greaterThanOrEqual(2); 25 | }); 26 | }); -------------------------------------------------------------------------------- /test/regularInstance.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Regular instance methods.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Regular'); 9 | }); 10 | 11 | it('Fuzz simple method instance', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'regular_instance_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(3); 17 | }); 18 | 19 | it('Fuzz regular method instance', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'regular_instance_regular'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.greaterThanOrEqual(4); 25 | }); 26 | 27 | it('Fuzz async interface instance', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'regular_instance_IAsync'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.greaterThanOrEqual(4); 33 | }); 34 | 35 | it('Fuzz async method instance', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'regular_instance_async'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.greaterThanOrEqual(3); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/regularStatic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Regular static methods.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Regular'); 9 | }); 10 | 11 | it('Fuzz simple method static', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'regular_static_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(3); 17 | }); 18 | 19 | it('Fuzz regular method static', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'regular_static_regular'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.greaterThanOrEqual(4); 25 | }); 26 | 27 | it('Fuzz async interface static', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'regular_static_IAsync'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.greaterThanOrEqual(4); 33 | }); 34 | 35 | it('Fuzz async method static', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'regular_static_async'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.greaterThanOrEqual(3); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/simpleInstance.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Simple instance methods.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Simple'); 9 | }); 10 | 11 | it('Fuzz simple method instance', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'simple_instance_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(3); 17 | }); 18 | 19 | it('Fuzz regular method instance', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'simple_instance_regular'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(6); 25 | }); 26 | 27 | it('Fuzz async interface instance', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'simple_instance_IAsync'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(6); 33 | }); 34 | 35 | 36 | it('Fuzz async method instance', async () => { 37 | const results: any[] = global.fastFuzzResults; 38 | 39 | const method = results.find((result: any) => result.name === 'simple_instance_async'); 40 | expect(method).to.not.equal(undefined); 41 | expect(method.results.length).to.equal(6); 42 | }); 43 | }); -------------------------------------------------------------------------------- /test/simpleStatic.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Simple static methods.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Simple'); 9 | }); 10 | 11 | it('Fuzz simple method static', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'simple_static_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(3); 17 | }); 18 | 19 | it('Fuzz regular method static', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'simple_static_regular'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(6); 25 | }); 26 | 27 | it('Fuzz async interface static', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'simple_static_IAsync'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(6); 33 | }); 34 | 35 | 36 | it('Fuzz async method static', async () => { 37 | const results: any[] = global.fastFuzzResults; 38 | 39 | const method = results.find((result: any) => result.name === 'simple_static_async'); 40 | expect(method).to.not.equal(undefined); 41 | expect(method.results.length).to.equal(6); 42 | }); 43 | 44 | it('Fuzz simple method with error', async () => { 45 | const results: any[] = global.fastFuzzResults; 46 | 47 | const method = results.find((result: any) => result.name === 'simple_static_error'); 48 | expect(method).to.not.equal(undefined); 49 | expect(method.results.length).to.equal(3); 50 | }); 51 | 52 | it('Fuzz simple async method with error', async () => { 53 | const results: any[] = global.fastFuzzResults; 54 | 55 | const method = results.find((result: any) => result.name === 'simple_static_error_async'); 56 | expect(method).to.not.equal(undefined); 57 | expect(method.results.length).to.equal(3); 58 | }); 59 | }); -------------------------------------------------------------------------------- /test/skip.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Skip decorator targets.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Skip'); 9 | }); 10 | 11 | it('Skip property in simple instance method.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'skip_instance_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(1); 17 | }); 18 | 19 | it('Skip argument in simple static method.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'skip_static_simple'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(1); 25 | }); 26 | 27 | it('Skip simple static method.', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'skip_static_skip'); 31 | expect(method).to.equal(undefined); 32 | }); 33 | 34 | it('Skip all arguments in simple static method.', async () => { 35 | const results: any[] = global.fastFuzzResults; 36 | 37 | const method = results.find((result: any) => result.name === 'skip_static_all'); 38 | expect(method).to.not.equal(undefined); 39 | expect(method.results.length).to.equal(1); 40 | }); 41 | 42 | it('Skip simple instance method.', async () => { 43 | const results: any[] = global.fastFuzzResults; 44 | 45 | const method = results.find((result: any) => result.name === 'skip_instance_skip'); 46 | expect(method).to.equal(undefined); 47 | }); 48 | }); -------------------------------------------------------------------------------- /test/sut/enumNum.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzArgType, 3 | fuzzMethod 4 | } from "../../src/fast-fuzz"; 5 | 6 | const literals = { 7 | nil: 0, 8 | m1: -1, 9 | emptyStr: '', 10 | longStr: 'RkeRxOSF4BfSpgc5Dc7hGumMO', 11 | n1: 1, 12 | n2: 2, 13 | n3: 3, 14 | n4: 4 15 | }; 16 | 17 | export enum Direction_Default { 18 | Up, 19 | Down, 20 | Left, 21 | Right, 22 | } 23 | 24 | export enum Direction_Auto { 25 | Up = 1, 26 | Down, 27 | Left, 28 | Right, 29 | } 30 | 31 | export class Enum_Num { 32 | 33 | @fuzzMethod 34 | public static enum_num_default( 35 | @fuzzArgType('Direction_Default') 36 | arg: Direction_Default 37 | ): string { 38 | /* #region Falsy values */ 39 | if (arg === undefined) { 40 | return `Undefined: ${arg}`; 41 | } else if (arg === null) { 42 | return `Null: ${arg}`; 43 | } else if (Number.isNaN(arg)) { 44 | return `NaN: ${arg}`; 45 | } else if (arg === 0) { 46 | return `Zero: ${arg}`; 47 | } else if (arg === Number.MIN_SAFE_INTEGER) { 48 | return `Min int: ${arg}`; 49 | } else if (arg === Number.MAX_SAFE_INTEGER) { 50 | return `Max int: ${arg}`; 51 | } else if (arg === literals.m1 * Number.MIN_VALUE) { 52 | return `Negative min decimal: ${arg}`; 53 | } else if (arg === Number.MIN_VALUE) { 54 | return `Positive min decimal: ${arg}`; 55 | } else if (arg === literals.m1 * Number.MAX_VALUE) { 56 | return `Min float: ${arg}`; 57 | } else if (arg === Number.MAX_VALUE) { 58 | return `Max float: ${arg}`; 59 | } else if (arg === Number.NEGATIVE_INFINITY) { 60 | return `Negative infinity: ${arg}`; 61 | } else if (arg === Number.POSITIVE_INFINITY) { 62 | return `Positive infinity: ${arg}`; 63 | } else if (`${arg}` === literals.emptyStr) { 64 | return `Empty string: ${arg}`; 65 | } else if (`${arg}` === literals.longStr) { 66 | return `Long literal(25): ${arg}`; 67 | /* #endregion */ 68 | 69 | } else if (arg === literals.n1) { 70 | return `Direction.Down: ${arg}`; 71 | } else if (arg === literals.n2) { 72 | return `Direction.Left: ${arg}`; 73 | } else if (arg === literals.n3) { 74 | return `Direction.Right: ${arg}`; 75 | 76 | // Ignores this branch. 77 | } else { 78 | return `Unkown: ${arg}`; 79 | } 80 | } 81 | 82 | @fuzzMethod 83 | public static enum_num_auto( 84 | @fuzzArgType('Direction_Auto') 85 | arg: Direction_Auto 86 | ): string { 87 | /* #region Falsy values */ 88 | if (arg === undefined) { 89 | return `Undefined: ${arg}`; 90 | } else if (arg === null) { 91 | return `Null: ${arg}`; 92 | } else if (Number.isNaN(arg)) { 93 | return `NaN: ${arg}`; 94 | } else if (arg === literals.nil) { 95 | return `Zero: ${arg}`; 96 | } else if (arg === Number.MIN_SAFE_INTEGER) { 97 | return `Min int: ${arg}`; 98 | } else if (arg === Number.MAX_SAFE_INTEGER) { 99 | return `Max int: ${arg}`; 100 | } else if (arg === literals.m1 * Number.MIN_VALUE) { 101 | return `Negative min decimal: ${arg}`; 102 | } else if (arg === Number.MIN_VALUE) { 103 | return `Positive min decimal: ${arg}`; 104 | } else if (arg === literals.m1 * Number.MAX_VALUE) { 105 | return `Min float: ${arg}`; 106 | } else if (arg === Number.MAX_VALUE) { 107 | return `Max float: ${arg}`; 108 | } else if (arg === Number.NEGATIVE_INFINITY) { 109 | return `Negative infinity: ${arg}`; 110 | } else if (arg === Number.POSITIVE_INFINITY) { 111 | return `Positive infinity: ${arg}`; 112 | } else if (`${arg}` === literals.emptyStr) { 113 | return `Empty string: ${arg}`; 114 | } else if (`${arg}` === literals.longStr) { 115 | return `Long literal(25): ${arg}`; 116 | /* #endregion */ 117 | 118 | } else if (arg === literals.n1) { 119 | return `Direction.Up: ${arg}`; 120 | } else if (arg === literals.n2) { 121 | return `Direction.Down: ${arg}`; 122 | } else if (arg === literals.n3) { 123 | return `Direction.Left: ${arg}`; 124 | } else if (arg === literals.n4) { 125 | return `Direction.Right: ${arg}`; 126 | 127 | // Ignores this branch. 128 | } else { 129 | return `Unkown: ${arg}`; 130 | } 131 | } 132 | } -------------------------------------------------------------------------------- /test/sut/enumNumArray.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzArgType, 3 | fuzzMethod 4 | } from "../../src/fast-fuzz"; 5 | 6 | const literals = { 7 | nil: 0, 8 | m1: -1, 9 | emptyStr: '', 10 | longStr: 'RkeRxOSF4BfSpgc5Dc7hGumMO', 11 | n1: 1, 12 | n2: 2, 13 | n3: 3, 14 | n4: 4 15 | }; 16 | 17 | export enum Direction_Array { 18 | Up, 19 | Down, 20 | Left, 21 | Right, 22 | } 23 | 24 | export class Enum_Num_Array { 25 | 26 | @fuzzMethod 27 | public static enum_num_array( 28 | @fuzzArgType('Direction_Array', 1) 29 | argArray: Direction_Array[] 30 | ): string { 31 | 32 | switch (argArray) { 33 | case undefined: 34 | return `Undefined []: ${argArray}`; 35 | case null: 36 | return `Null []: ${argArray}`; 37 | default: 38 | break; 39 | } 40 | if (argArray.length === 0) { 41 | return `Empty []: ${JSON.stringify(argArray)}`; 42 | } 43 | 44 | const arg: Direction_Array = argArray[0]; 45 | 46 | /* #region Falsy values */ 47 | if (arg === undefined) { 48 | return `Undefined: ${arg}`; 49 | } else if (arg === null) { 50 | return `Null: ${arg}`; 51 | } else if (Number.isNaN(arg)) { 52 | return `NaN: ${arg}`; 53 | } else if (arg === 0) { 54 | return `Zero: ${arg}`; 55 | } else if (arg === Number.MIN_SAFE_INTEGER) { 56 | return `Min int: ${arg}`; 57 | } else if (arg === Number.MAX_SAFE_INTEGER) { 58 | return `Max int: ${arg}`; 59 | } else if (arg === literals.m1 * Number.MIN_VALUE) { 60 | return `Negative min decimal: ${arg}`; 61 | } else if (arg === Number.MIN_VALUE) { 62 | return `Positive min decimal: ${arg}`; 63 | } else if (arg === literals.m1 * Number.MAX_VALUE) { 64 | return `Min float: ${arg}`; 65 | } else if (arg === Number.MAX_VALUE) { 66 | return `Max float: ${arg}`; 67 | } else if (arg === Number.NEGATIVE_INFINITY) { 68 | return `Negative infinity: ${arg}`; 69 | } else if (arg === Number.POSITIVE_INFINITY) { 70 | return `Positive infinity: ${arg}`; 71 | } else if (`${arg}` === literals.emptyStr) { 72 | return `Empty string: ${arg}`; 73 | } else if (`${arg}` === literals.longStr) { 74 | return `Long literal(25): ${arg}`; 75 | /* #endregion */ 76 | 77 | } else if (arg === literals.n1) { 78 | return `Direction.Down: ${arg}`; 79 | } else if (arg === literals.n2) { 80 | return `Direction.Left: ${arg}`; 81 | } else if (arg === literals.n3) { 82 | return `Direction.Right: ${arg}`; 83 | 84 | // Ignores this branch. 85 | } else { 86 | return `Unkown: ${arg}`; 87 | } 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /test/sut/guidedInstance.ts: -------------------------------------------------------------------------------- 1 | const FlatPromise = require("flat-promise"); 2 | import { 3 | fuzzArg, 4 | fuzzMethod, 5 | fuzzProp 6 | } from "../../src/fast-fuzz"; 7 | 8 | const AGE_17 = 17; 9 | const AGE_22 = 22; 10 | const CODE_7 = 7; 11 | const CODE_10 = 10; 12 | 13 | export class Guided_Instance { 14 | @fuzzProp("string") name: string; 15 | @fuzzProp("integer", 0, 15, 25) age: number; 16 | @fuzzProp("integer", 0, 5, 10) code: number; 17 | 18 | @fuzzMethod 19 | public guided_instance_simple ( 20 | @fuzzArg("integer", 0, 15, 25) _age: number 21 | ): boolean { 22 | switch (this.age) { 23 | case AGE_22: 24 | return false; 25 | case AGE_17: 26 | return false; 27 | default: 28 | break; 29 | } 30 | 31 | return true; 32 | } 33 | 34 | @fuzzMethod 35 | public guided_instance_regular ( 36 | @fuzzArg("string") _name: string, 37 | @fuzzArg("integer", 0, 15, 25) _age: number, 38 | @fuzzArg("integer", 0, 5, 10) _code: number 39 | ): boolean { 40 | if (this.code == CODE_7) { 41 | if (this.name == 'Bob') { 42 | return false; 43 | } 44 | } else if (this.code == CODE_10) { 45 | if (this.age == AGE_22 && this.name == 'Alice') { 46 | return false; 47 | } 48 | } 49 | return true; 50 | } 51 | 52 | @fuzzMethod 53 | public async guided_instance_IAsync( 54 | @fuzzArg("string") _name: string, 55 | @fuzzArg("integer", 0, 15, 25) _age: number, 56 | @fuzzArg("integer", 0, 5, 10) _code: number 57 | ): Promise { 58 | if (this.code == CODE_7) { 59 | if (this.name == 'Bob') { 60 | return false; 61 | } 62 | } else if (this.code == CODE_10) { 63 | if (this.age == AGE_22 && this.name == 'Alice') { 64 | return false; 65 | } 66 | } 67 | return true; 68 | } 69 | 70 | @fuzzMethod 71 | public async guided_instance_async( 72 | @fuzzArg("string") _name: string, 73 | @fuzzArg("integer", 0, 15, 25) _age: number, 74 | @fuzzArg("integer", 0, 5, 10) _code: number 75 | ): Promise { 76 | const flatPromise = new FlatPromise(); 77 | 78 | setTimeout(() => { 79 | if (this.code == CODE_7) { 80 | if (this.name == 'Bob') { 81 | flatPromise.resolve(false); 82 | } 83 | } else if (this.code == CODE_10) { 84 | if (this.age == AGE_22 && this.name == 'Alice') { 85 | flatPromise.resolve(false); 86 | } 87 | } 88 | flatPromise.resolve(true); 89 | }, 1); 90 | 91 | return await flatPromise.promise; 92 | } 93 | } -------------------------------------------------------------------------------- /test/sut/guidedStatic.ts: -------------------------------------------------------------------------------- 1 | const FlatPromise = require("flat-promise"); 2 | import { 3 | fuzzArg, 4 | fuzzMethod 5 | } from "../../src/fast-fuzz"; 6 | 7 | const AGE_17 = 17; 8 | const AGE_22 = 22; 9 | const CODE_7 = 7; 10 | const CODE_10 = 10; 11 | 12 | export class Guided_Static { 13 | 14 | @fuzzMethod 15 | public static guided_static_simple ( 16 | @fuzzArg("integer", 0, 15, 25) age: number 17 | ): boolean { 18 | 19 | switch (age) { 20 | case AGE_22: 21 | return false; 22 | case AGE_17: 23 | return false; 24 | default: 25 | break; 26 | } 27 | return true; 28 | } 29 | 30 | @fuzzMethod 31 | public static guided_static_regular ( 32 | @fuzzArg("string") name: string, 33 | @fuzzArg("integer", 0, 15, 25) age: number, 34 | @fuzzArg("integer", 0, 5, 10) code: number 35 | ): boolean { 36 | if (code == CODE_7) { 37 | if (name == 'Bob') { 38 | return false; 39 | } 40 | } else if (code == CODE_10) { 41 | if (age == AGE_22 && name == 'Alice') { 42 | return false; 43 | } 44 | } 45 | 46 | return true; 47 | } 48 | 49 | @fuzzMethod 50 | public static async guided_static_IAsync( 51 | @fuzzArg("string") name: string, 52 | @fuzzArg("integer", 0, 15, 25) age: number, 53 | @fuzzArg("integer", 0, 5, 10) code: number 54 | ): Promise { 55 | if (code == CODE_7) { 56 | if (name == 'Bob') { 57 | return false; 58 | } 59 | } else if (code == CODE_10) { 60 | if (age == AGE_22 && name == 'Alice') { 61 | return false; 62 | } 63 | } 64 | return true; 65 | } 66 | 67 | @fuzzMethod 68 | public static async guided_static_async( 69 | @fuzzArg("string") name: string, 70 | @fuzzArg("integer", 0, 15, 25) age: number, 71 | @fuzzArg("integer", 0, 5, 10) code: number 72 | ): Promise { 73 | const flatPromise = new FlatPromise(); 74 | 75 | setTimeout(() => { 76 | if (code == CODE_7) { 77 | if (name == 'Bob') { 78 | flatPromise.resolve(false); 79 | } 80 | } else if (code == CODE_10) { 81 | if (age == AGE_22 && name == 'Alice') { 82 | flatPromise.resolve(false); 83 | } 84 | } 85 | flatPromise.resolve(true); 86 | }, 1); 87 | 88 | return await flatPromise.promise; 89 | } 90 | } -------------------------------------------------------------------------------- /test/sut/naked.ts: -------------------------------------------------------------------------------- 1 | export class Naked { 2 | age: number; 3 | 4 | public naked_instance (): string { 5 | if (this.age === undefined) { 6 | return `Undefined: ${this.age}`; 7 | } else if (this.age === null) { 8 | return `Null: ${this.age}`; 9 | } 10 | 11 | switch (this.age) { 12 | case 22: 13 | return `Branch 1: ${JSON.stringify(this.age)}`; 14 | case 17: 15 | return `Branch 2: ${JSON.stringify(this.age)}`; 16 | default: 17 | break; 18 | } 19 | return `Branch 0: ${JSON.stringify(this.age)}`; 20 | } 21 | 22 | public static naked_static ( 23 | age: number 24 | ): string { 25 | if (age === undefined) { 26 | return `Undefined: ${age}`; 27 | } else if (age === null) { 28 | return `Null: ${age}`; 29 | } 30 | 31 | switch (age) { 32 | case 22: 33 | return `Branch 1: ${JSON.stringify(age)}`; 34 | case 17: 35 | return `Branch 2: ${JSON.stringify(age)}`; 36 | default: 37 | break; 38 | } 39 | return `Branch 0: ${JSON.stringify(age)}`; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /test/sut/regularInstance.ts: -------------------------------------------------------------------------------- 1 | const FlatPromise = require("flat-promise"); 2 | import { 3 | fuzzArg, 4 | fuzzMethod, 5 | fuzzProp 6 | } from "../../src/fast-fuzz"; 7 | 8 | const AGE_17 = 17; 9 | const AGE_22 = 22; 10 | const CODE_7 = 7; 11 | const CODE_10 = 10; 12 | 13 | export class Regular_Instance { 14 | @fuzzProp("string") name: string; 15 | @fuzzProp("integer") age: number; 16 | @fuzzProp("integer") code: number; 17 | 18 | @fuzzMethod 19 | public regular_instance_simple ( 20 | @fuzzArg("integer") _age: number 21 | ): boolean { 22 | switch (this.age) { 23 | case AGE_22: 24 | return false; 25 | case AGE_17: 26 | return false; 27 | default: 28 | break; 29 | } 30 | 31 | return true; 32 | } 33 | 34 | @fuzzMethod 35 | public regular_instance_regular ( 36 | @fuzzArg("string") _name: string, 37 | @fuzzArg("integer") _age: number, 38 | @fuzzArg("integer") _code: number 39 | ): boolean { 40 | if (this.code == CODE_7) { 41 | if (this.name == 'Bob') { 42 | return false; 43 | } 44 | } else if (this.code == CODE_10) { 45 | if (this.age == AGE_22 && this.name == 'Alice') { 46 | return false; 47 | } 48 | } 49 | return true; 50 | } 51 | 52 | @fuzzMethod 53 | public async regular_instance_IAsync( 54 | @fuzzArg("string") _name: string, 55 | @fuzzArg("integer") _age: number, 56 | @fuzzArg("integer") _code: number 57 | ): Promise { 58 | if (this.code == CODE_7) { 59 | if (this.name == 'Bob') { 60 | return false; 61 | } 62 | } else if (this.code == CODE_10) { 63 | if (this.age == AGE_22 && this.name == 'Alice') { 64 | return false; 65 | } 66 | } 67 | return true; 68 | } 69 | 70 | @fuzzMethod 71 | public async regular_instance_async( 72 | @fuzzArg("string") _name: string, 73 | @fuzzArg("integer") _age: number, 74 | @fuzzArg("integer") _code: number 75 | ): Promise { 76 | const flatPromise = new FlatPromise(); 77 | 78 | setTimeout(() => { 79 | if (this.code == CODE_7) { 80 | if (this.name == 'Bob') { 81 | flatPromise.resolve(false); 82 | } 83 | } else if (this.code == CODE_10) { 84 | if (this.age == AGE_22 && this.name == 'Alice') { 85 | flatPromise.resolve(false); 86 | } 87 | } 88 | flatPromise.resolve(true); 89 | }, 1); 90 | 91 | return await flatPromise.promise; 92 | } 93 | } -------------------------------------------------------------------------------- /test/sut/regularStatic.ts: -------------------------------------------------------------------------------- 1 | const FlatPromise = require("flat-promise"); 2 | import { 3 | fuzzArg, 4 | fuzzMethod 5 | } from "../../src/fast-fuzz"; 6 | 7 | const AGE_17 = 17; 8 | const AGE_22 = 22; 9 | const CODE_7 = 7; 10 | const CODE_10 = 10; 11 | 12 | export class Regular_Static { 13 | 14 | @fuzzMethod 15 | public static regular_static_simple ( 16 | @fuzzArg("integer") age: number 17 | ): boolean { 18 | 19 | switch (age) { 20 | case AGE_22: 21 | return false; 22 | case AGE_17: 23 | return false; 24 | default: 25 | break; 26 | } 27 | return true; 28 | } 29 | 30 | @fuzzMethod 31 | public static regular_static_regular ( 32 | @fuzzArg("string") name: string, 33 | @fuzzArg("integer") age: number, 34 | @fuzzArg("integer") code: number 35 | ): boolean { 36 | if (code == CODE_7) { 37 | if (name == 'Bob') { 38 | return false; 39 | } 40 | } else if (code == CODE_10) { 41 | if (age == AGE_22 && name == 'Alice') { 42 | return false; 43 | } 44 | } 45 | 46 | return true; 47 | } 48 | 49 | @fuzzMethod 50 | public static async regular_static_IAsync( 51 | @fuzzArg("string") name: string, 52 | @fuzzArg("integer") age: number, 53 | @fuzzArg("integer") code: number 54 | ): Promise { 55 | if (code == CODE_7) { 56 | if (name == 'Bob') { 57 | return false; 58 | } 59 | } else if (code == CODE_10) { 60 | if (age == AGE_22 && name == 'Alice') { 61 | return false; 62 | } 63 | } 64 | return true; 65 | } 66 | 67 | @fuzzMethod 68 | public static async regular_static_async( 69 | @fuzzArg("string") name: string, 70 | @fuzzArg("integer") age: number, 71 | @fuzzArg("integer") code: number 72 | ): Promise { 73 | const flatPromise = new FlatPromise(); 74 | 75 | setTimeout(() => { 76 | if (code == CODE_7) { 77 | if (name == 'Bob') { 78 | flatPromise.resolve(false); 79 | } 80 | } else if (code == CODE_10) { 81 | if (age == AGE_22 && name == 'Alice') { 82 | flatPromise.resolve(false); 83 | } 84 | } 85 | flatPromise.resolve(true); 86 | }, 1); 87 | 88 | return await flatPromise.promise; 89 | } 90 | } -------------------------------------------------------------------------------- /test/sut/simpleInstance.ts: -------------------------------------------------------------------------------- 1 | const FlatPromise = require("flat-promise"); 2 | import { 3 | fuzzArg, 4 | fuzzMethod, 5 | fuzzProp 6 | } from "../../src/fast-fuzz"; 7 | 8 | export class Simple_Instance { 9 | @fuzzProp("string") name: string; 10 | @fuzzProp("integer") age: number; 11 | @fuzzProp("integer") code: number; 12 | 13 | @fuzzMethod 14 | public simple_instance_simple ( 15 | @fuzzArg("integer") _age: number 16 | ): boolean { 17 | switch (this.age) { 18 | case 22: 19 | return false; 20 | case 17: 21 | return false; 22 | default: 23 | break; 24 | } 25 | 26 | return true; 27 | } 28 | 29 | @fuzzMethod 30 | public simple_instance_regular ( 31 | @fuzzArg("string") _name: string, 32 | @fuzzArg("integer") _age: number, 33 | @fuzzArg("integer") _code: number 34 | ): boolean { 35 | if (this.code == 7) { 36 | if (this.name == 'Bob') { 37 | return false; 38 | } 39 | } else if (this.code == 10) { 40 | if (this.age == 22 && this.name == 'Alice') { 41 | return false; 42 | } 43 | } 44 | return true; 45 | } 46 | 47 | @fuzzMethod 48 | public async simple_instance_IAsync( 49 | @fuzzArg("string") _name: string, 50 | @fuzzArg("integer") _age: number, 51 | @fuzzArg("integer") _code: number 52 | ): Promise { 53 | if (this.code == 7) { 54 | if (this.name == 'Bob') { 55 | return false; 56 | } 57 | } else if (this.code == 10) { 58 | if (this.age == 22 && this.name == 'Alice') { 59 | return false; 60 | } 61 | } 62 | return true; 63 | } 64 | 65 | @fuzzMethod 66 | public async simple_instance_async( 67 | @fuzzArg("string") _name: string, 68 | @fuzzArg("integer") _age: number, 69 | @fuzzArg("integer") _code: number 70 | ): Promise { 71 | const flatPromise = new FlatPromise(); 72 | 73 | setTimeout(() => { 74 | if (this.code == 7) { 75 | if (this.name == 'Bob') { 76 | flatPromise.resolve(false); 77 | } 78 | } else if (this.code == 10) { 79 | if (this.age == 22 && this.name == 'Alice') { 80 | flatPromise.resolve(false); 81 | } 82 | } 83 | flatPromise.resolve(true); 84 | }, 1); 85 | 86 | return await flatPromise.promise; 87 | } 88 | } -------------------------------------------------------------------------------- /test/sut/simpleStatic.ts: -------------------------------------------------------------------------------- 1 | const FlatPromise = require("flat-promise"); 2 | import { 3 | fuzzArg, 4 | fuzzMethod 5 | } from "../../src/fast-fuzz"; 6 | 7 | export class Simple_Static { 8 | 9 | @fuzzMethod 10 | public static simple_static_simple ( 11 | @fuzzArg("integer") age: number 12 | ): boolean { 13 | 14 | switch (age) { 15 | case 22: 16 | return false; 17 | case 17: 18 | return false; 19 | default: 20 | break; 21 | } 22 | return true; 23 | } 24 | 25 | @fuzzMethod 26 | public static simple_static_regular ( 27 | @fuzzArg("string") name: string, 28 | @fuzzArg("integer") age: number, 29 | @fuzzArg("integer") code: number 30 | ): boolean { 31 | if (code == 7) { 32 | if (name == 'Bob') { 33 | return false; 34 | } 35 | } else if (code == 10) { 36 | if (age == 22 && name == 'Alice') { 37 | return false; 38 | } 39 | } 40 | 41 | return true; 42 | } 43 | 44 | @fuzzMethod 45 | public static async simple_static_IAsync( 46 | @fuzzArg("string") name: string, 47 | @fuzzArg("integer") age: number, 48 | @fuzzArg("integer") code: number 49 | ): Promise { 50 | if (code == 7) { 51 | if (name == 'Bob') { 52 | return false; 53 | } 54 | } else if (code == 10) { 55 | if (age == 22 && name == 'Alice') { 56 | return false; 57 | } 58 | } 59 | return true; 60 | } 61 | 62 | @fuzzMethod 63 | public static async simple_static_async( 64 | @fuzzArg("string") name: string, 65 | @fuzzArg("integer") age: number, 66 | @fuzzArg("integer") code: number 67 | ): Promise { 68 | const flatPromise = new FlatPromise(); 69 | 70 | setTimeout(() => { 71 | if (code == 7) { 72 | if (name == 'Bob') { 73 | flatPromise.resolve(false); 74 | } 75 | } else if (code == 10) { 76 | if (age == 22 && name == 'Alice') { 77 | flatPromise.resolve(false); 78 | } 79 | } 80 | flatPromise.resolve(true); 81 | }, 1); 82 | 83 | return await flatPromise.promise; 84 | } 85 | 86 | @fuzzMethod 87 | public static simple_static_error ( 88 | @fuzzArg("integer") age: number 89 | ): boolean { 90 | 91 | switch (age) { 92 | case 22: 93 | return false; 94 | case 17: 95 | throw new Error('Expected this.'); 96 | default: 97 | break; 98 | } 99 | return true; 100 | } 101 | 102 | @fuzzMethod 103 | public static async simple_static_error_async ( 104 | @fuzzArg("integer") age: number 105 | ): Promise { 106 | 107 | switch (age) { 108 | case 22: 109 | return false; 110 | case 17: 111 | throw new Error('Expected this.'); 112 | default: 113 | break; 114 | } 115 | return true; 116 | } 117 | } -------------------------------------------------------------------------------- /test/sut/skip.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzArg, 3 | fuzzMethod, 4 | fuzzProp, 5 | fuzzSkipArg, 6 | fuzzSkipProp, 7 | fuzzSkipMethod 8 | } from "../../src/fast-fuzz"; 9 | 10 | const AGE_17 = 17; 11 | const AGE_22 = 22; 12 | 13 | export class Skip { 14 | @fuzzProp("string") prop_1: string; 15 | @fuzzSkipProp age: number; 16 | @fuzzProp("integer", 0, 5, 10) code: number; 17 | 18 | private private_prop; 19 | 20 | @fuzzMethod 21 | public skip_instance_simple ( 22 | @fuzzArg("integer", 0, 15, 25) _age: number 23 | ): boolean { 24 | 25 | switch (this.age) { 26 | case AGE_22: 27 | return false; 28 | case AGE_17: 29 | return false; 30 | default: 31 | break; 32 | } 33 | return true; 34 | } 35 | 36 | @fuzzMethod 37 | public static skip_static_simple( 38 | @fuzzArg("string") _name: string, 39 | @fuzzSkipArg age: number, 40 | @fuzzArg("integer", 0, 5, 10) _code: number 41 | ): boolean { 42 | 43 | switch (age) { 44 | case AGE_22: 45 | return false; 46 | case AGE_17: 47 | return false; 48 | default: 49 | break; 50 | } 51 | return true; 52 | } 53 | 54 | @fuzzSkipMethod 55 | public static skip_static_skip( 56 | @fuzzArg("string") _name: string, 57 | @fuzzSkipArg age: number, 58 | @fuzzArg("integer", 0, 5, 10) _code: number 59 | ): boolean { 60 | 61 | switch (age) { 62 | case AGE_22: 63 | return false; 64 | case AGE_17: 65 | return false; 66 | default: 67 | break; 68 | } 69 | return true; 70 | } 71 | 72 | @fuzzMethod 73 | public static skip_static_all( 74 | @fuzzSkipArg _name: string, 75 | @fuzzSkipArg age: number, 76 | @fuzzSkipArg _code: number 77 | ): boolean { 78 | 79 | switch (age) { 80 | case AGE_22: 81 | return false; 82 | case AGE_17: 83 | return false; 84 | default: 85 | break; 86 | } 87 | return true; 88 | } 89 | 90 | @fuzzSkipMethod 91 | public skip_instance_skip( 92 | @fuzzSkipArg _name: string, 93 | @fuzzSkipArg _age: number, 94 | @fuzzSkipArg _code: number 95 | ): boolean { 96 | this.private_prop = 1; 97 | 98 | switch (this.private_prop === 1 && this.age) { 99 | case AGE_22: 100 | return false; 101 | case AGE_17: 102 | return false; 103 | default: 104 | break; 105 | } 106 | return true; 107 | } 108 | } -------------------------------------------------------------------------------- /test/sut/typeInherit.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzArgType, 3 | fuzzMethod 4 | } from "../../src/fast-fuzz"; 5 | import { IInstance } from "./typeInstance"; 6 | 7 | import { 8 | IReference, 9 | Reference_Abstract, 10 | Reference_Base 11 | } from "./typeReference"; 12 | 13 | export class Type_Inherit { 14 | 15 | @fuzzMethod 16 | public static type_inherit_simple( 17 | @fuzzArgType(Reference_Base.name) 18 | argInstance: Reference_Base 19 | ): string { 20 | if (argInstance === undefined) { 21 | return `Undefined: ${argInstance}`; 22 | } else if (argInstance === null) { 23 | return `Null: ${argInstance}`; 24 | } else if (Object.values(argInstance).length === 0) { 25 | return `Empty object {}: ${JSON.stringify(argInstance)}`; 26 | } 27 | 28 | const arg = argInstance.getValue(); 29 | 30 | switch (arg[1]) { 31 | case 22: 32 | return `Branch 1: ${JSON.stringify(arg)}`; 33 | case 17: 34 | return `Branch 2: ${JSON.stringify(arg)}`; 35 | default: 36 | break; 37 | } 38 | return `Branch 0: ${JSON.stringify(arg)}`; 39 | } 40 | 41 | @fuzzMethod 42 | public static type_inherit_abstract( 43 | @fuzzArgType(Reference_Abstract.name) 44 | argInstance: Reference_Abstract 45 | ): string { 46 | if (argInstance === undefined) { 47 | return `Undefined: ${argInstance}`; 48 | } else if (argInstance === null) { 49 | return `Null: ${argInstance}`; 50 | } else if (Object.values(argInstance).length === 0) { 51 | return `Empty object {}: ${JSON.stringify(argInstance)}`; 52 | } 53 | 54 | const arg = argInstance.getValue(); 55 | 56 | switch (arg[1]) { 57 | case 22: 58 | return `Branch 1: ${JSON.stringify(arg)}`; 59 | case 17: 60 | return `Branch 2: ${JSON.stringify(arg)}`; 61 | default: 62 | break; 63 | } 64 | return `Branch 0: ${JSON.stringify(arg)}`; 65 | } 66 | 67 | @fuzzMethod 68 | public static type_inherit_interface( 69 | @fuzzArgType('IReference') 70 | argInstance: IReference 71 | ): string { 72 | if (argInstance === undefined) { 73 | return `Undefined: ${argInstance}`; 74 | } else if (argInstance === null) { 75 | return `Null: ${argInstance}`; 76 | } else if (Object.values(argInstance).length === 0) { 77 | return `Empty object {}: ${JSON.stringify(argInstance)}`; 78 | } 79 | 80 | const arg = argInstance.getValue(); 81 | 82 | switch (arg[1]) { 83 | case 22: 84 | return `Branch 1: ${JSON.stringify(arg)}`; 85 | case 17: 86 | return `Branch 2: ${JSON.stringify(arg)}`; 87 | default: 88 | break; 89 | } 90 | return `Branch 0: ${JSON.stringify(arg)}`; 91 | } 92 | 93 | @fuzzMethod 94 | public static type_instance( 95 | @fuzzArgType('IInstance') 96 | argInstance: IInstance 97 | ): string { 98 | if (argInstance === undefined) { 99 | return `Undefined: ${argInstance}`; 100 | } else if (argInstance === null) { 101 | return `Null: ${argInstance}`; 102 | } else if (Object.values(argInstance).length === 0) { 103 | return `Empty object {}: ${JSON.stringify(argInstance)}`; 104 | } 105 | 106 | const arg = argInstance.getValue(); 107 | 108 | switch (arg[1]) { 109 | case 22: 110 | return `Branch 1: ${JSON.stringify(arg)}`; 111 | case 17: 112 | return `Branch 2: ${JSON.stringify(arg)}`; 113 | default: 114 | break; 115 | } 116 | return `Branch 0: ${JSON.stringify(arg)}`; 117 | } 118 | } -------------------------------------------------------------------------------- /test/sut/typeInstance.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzProp 3 | } from "../../src/fast-fuzz"; 4 | 5 | export interface IInstance { 6 | name: string; 7 | age: number; 8 | code: number; 9 | 10 | getValue(): any[]; 11 | } 12 | 13 | export class Reference_Instance implements IInstance { 14 | @fuzzProp("string") name: string; 15 | @fuzzProp("integer") age: number; 16 | @fuzzProp("integer") code: number; 17 | 18 | constructor(init: Partial) { 19 | Object.assign(this, init); 20 | } 21 | 22 | getValue(): any[] { 23 | return [this.name, this.age, this.code, Reference_Instance.name]; 24 | } 25 | } -------------------------------------------------------------------------------- /test/sut/typeReference.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzProp 3 | } from "../../src/fast-fuzz"; 4 | 5 | export interface IReference { 6 | name: string; 7 | age: number; 8 | code: number; 9 | 10 | getValue(): any[]; 11 | } 12 | 13 | export abstract class Reference_Abstract implements IReference { 14 | @fuzzProp("string") name: string; 15 | @fuzzProp("integer") age: number; 16 | @fuzzProp("integer") code: number; 17 | 18 | constructor(init: Partial) { 19 | Object.assign(this, init); 20 | } 21 | 22 | abstract getValue(): any[]; 23 | } 24 | 25 | export class Reference_Base extends Reference_Abstract { 26 | getValue(): any[] { 27 | return [this.name, this.age, this.code, Reference_Base.name]; 28 | } 29 | } 30 | 31 | export class Reference_Derived extends Reference_Base { 32 | getValue(): any[] { 33 | return [this.name, this.age, this.code, Reference_Derived.name]; 34 | } 35 | } -------------------------------------------------------------------------------- /test/sut/typeSingle.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzArgType, 3 | fuzzMethod 4 | } from "../../src/fast-fuzz"; 5 | import { Reference_Derived } from "./typeReference"; 6 | 7 | export class Type_Single { 8 | age: number; 9 | 10 | @fuzzMethod 11 | public static type_single_simple( 12 | @fuzzArgType(Reference_Derived.name) 13 | argInstance: Reference_Derived 14 | ): string { 15 | if (argInstance === undefined) { 16 | return `Undefined: ${argInstance}`; 17 | } else if (argInstance === null) { 18 | return `Null: ${argInstance}`; 19 | } else if (Object.values(argInstance).length === 0) { 20 | return `Empty object {}: ${JSON.stringify(argInstance)}`; 21 | } 22 | 23 | const arg = argInstance.getValue(); 24 | if (arg[3] !== Reference_Derived.name) { 25 | return `Wrong type: ${arg[3]}`; 26 | } 27 | 28 | switch (arg[1]) { 29 | case 22: 30 | return `Branch 1: ${JSON.stringify(arg)}`; 31 | case 17: 32 | return `Branch 2: ${JSON.stringify(arg)}`; 33 | default: 34 | break; 35 | } 36 | return `Branch 0: ${JSON.stringify(arg)}`; 37 | } 38 | 39 | @fuzzMethod 40 | public static type_single_array( 41 | @fuzzArgType(Reference_Derived.name, 1) 42 | argArray: Reference_Derived[] 43 | ): string { 44 | if (argArray === undefined) { 45 | return `Undefined []: ${JSON.stringify(argArray)}`; 46 | } else if (argArray === null) { 47 | return `Null []: ${JSON.stringify(argArray)}`; 48 | } else if (argArray.length === 0) { 49 | return `Empty []: ${JSON.stringify(argArray)}`; 50 | } 51 | 52 | const argInstance = argArray[0]; 53 | 54 | if (argInstance === undefined) { 55 | return `Undefined: ${argInstance}`; 56 | } else if (argInstance === null) { 57 | return `Null: ${argInstance}`; 58 | } else if (Object.values(argInstance).length === 0) { 59 | return `Empty object {}: ${JSON.stringify(argInstance)}`; 60 | } 61 | 62 | const arg = argInstance.getValue(); 63 | 64 | switch (arg[1]) { 65 | case 22: 66 | return `Branch 1: ${JSON.stringify(arg)}`; 67 | case 17: 68 | return `Branch 2: ${JSON.stringify(arg)}`; 69 | default: 70 | break; 71 | } 72 | return `Branch 0: ${JSON.stringify(arg)}`; 73 | } 74 | 75 | @fuzzMethod 76 | public static type_single_regular( 77 | @fuzzArgType(Reference_Derived.name) 78 | argInstance: Reference_Derived 79 | ): string { 80 | if (argInstance === undefined) { 81 | return `Undefined: ${argInstance}`; 82 | } else if (argInstance === null) { 83 | return `Null: ${argInstance}`; 84 | } 85 | 86 | const arg = argInstance.getValue(); 87 | 88 | if (arg[2] == 7) { 89 | if (arg[0] == 'Bob') { 90 | return `Branch 1: ${JSON.stringify(arg)}`; 91 | } 92 | } else if (arg[2] == 10) { 93 | if (arg[1] == 22 && arg[0] == 'Alice') { 94 | return `Branch 2: ${JSON.stringify(arg)}`; 95 | } 96 | } 97 | return `Branch 0: ${JSON.stringify(arg)}`; 98 | } 99 | } -------------------------------------------------------------------------------- /test/sut/typeStuff.ts: -------------------------------------------------------------------------------- 1 | import { 2 | fuzzArgType, 3 | fuzzMethod 4 | } from "../../src/fast-fuzz"; 5 | import { IInstance } from "./typeInstance"; 6 | 7 | export class Stuff_Instance { 8 | 9 | @fuzzMethod 10 | public static stuff_instance( 11 | @fuzzArgType('IInstance') 12 | argInstance: IInstance 13 | ): string { 14 | if (argInstance === undefined) { 15 | return `Undefined: ${argInstance}`; 16 | } else if (argInstance === null) { 17 | return `Null: ${argInstance}`; 18 | } else if (Object.values(argInstance).length === 0) { 19 | return `Empty object {}: ${JSON.stringify(argInstance)}`; 20 | } 21 | 22 | const arg = argInstance.getValue(); 23 | 24 | switch (arg[1]) { 25 | case 22: 26 | return `Branch 1: ${JSON.stringify(arg)}`; 27 | case 17: 28 | return `Branch 2: ${JSON.stringify(arg)}`; 29 | default: 30 | break; 31 | } 32 | return `Branch 0: ${JSON.stringify(arg)}`; 33 | } 34 | } -------------------------------------------------------------------------------- /test/testRunner.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import { assert } from 'chai'; 3 | const execShellCommand = require("../execShellCommand.js"); 4 | 5 | const results: { [key: string]: any[] } = {}; 6 | 7 | export async function init( 8 | name: string, 9 | time = 15e3 10 | ): Promise { 11 | if (results[name] === undefined) { 12 | // Get rid of previous instances. 13 | const fileName = './test/sut/fuzzInstances.json'; 14 | if (name !== 'Stuff' && fs.existsSync(fileName)) { 15 | fs.unlinkSync(fileName); 16 | } 17 | 18 | const cliResult: string = await execShellCommand(`node ./dist/src/index.js -i "./test/sut" -s "./" -d "../../dist/test/sut" -c "${name}" -t ${time} -n 2 -q true`); 19 | 20 | let error: any; 21 | try { 22 | results[name] = JSON.parse(cliResult); 23 | } catch (e: any) { 24 | error = e; 25 | } 26 | assert.ok(error === undefined); 27 | } 28 | 29 | return results[name]; 30 | } -------------------------------------------------------------------------------- /test/typeInherit.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Type generators with inherited values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Type'); 9 | }); 10 | 11 | it('Generates single instance of type.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'type_inherit_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(6); 17 | }); 18 | 19 | it('Generates instance array of type.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'type_inherit_abstract'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(6); 25 | }); 26 | 27 | it('Generates single instance of type for a regular function.', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'type_inherit_interface'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.equal(6); 33 | }); 34 | 35 | it('Generates the fuzzInstances.json file.', async () => { 36 | const results: any[] = global.fastFuzzResults; 37 | 38 | const method = results.find((result: any) => result.name === 'type_instance'); 39 | expect(method).to.not.equal(undefined); 40 | expect(method.results.length).to.equal(6); 41 | }); 42 | }); -------------------------------------------------------------------------------- /test/typeSingle.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { init } from './testRunner'; 3 | 4 | describe('Type generators with simple values.', function () { 5 | this.timeout(3 * 60 * 1e3); 6 | 7 | before(async () => { 8 | global.fastFuzzResults = await init('Type'); 9 | }); 10 | 11 | it('Generates single instance of type.', async () => { 12 | const results: any[] = global.fastFuzzResults; 13 | 14 | const method = results.find((result: any) => result.name === 'type_single_simple'); 15 | expect(method).to.not.equal(undefined); 16 | expect(method.results.length).to.equal(6); 17 | }); 18 | 19 | it('Generates instance array of type.', async () => { 20 | const results: any[] = global.fastFuzzResults; 21 | 22 | const method = results.find((result: any) => result.name === 'type_single_array'); 23 | expect(method).to.not.equal(undefined); 24 | expect(method.results.length).to.equal(9); 25 | }); 26 | 27 | it('Generates single instance of type for a regular function.', async () => { 28 | const results: any[] = global.fastFuzzResults; 29 | 30 | const method = results.find((result: any) => result.name === 'type_single_regular'); 31 | expect(method).to.not.equal(undefined); 32 | expect(method.results.length).to.be.greaterThanOrEqual(6); 33 | }); 34 | }); -------------------------------------------------------------------------------- /test/typeStuff.test.ts: -------------------------------------------------------------------------------- 1 | import './typeInherit.test'; 2 | import { expect } from 'chai'; 3 | import { init } from './testRunner'; 4 | 5 | describe('Type generators with inherited values', function () { 6 | this.timeout(3 * 60 * 1e3); 7 | 8 | before(async () => { 9 | global.fastFuzzResults = await init('Stuff'); 10 | }); 11 | 12 | it('Loads and uses the fuzzInstances.json file.', async () => { 13 | const results: any[] = global.fastFuzzResults; 14 | 15 | const method = results.find((result: any) => result.name === 'stuff_instance'); 16 | expect(method).to.not.equal(undefined); 17 | expect(method.results.length).to.equal(6); 18 | }); 19 | }); -------------------------------------------------------------------------------- /tplant-3.1.2.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeWatchWall/fast-fuzz/824b66f31d5a1973801bd117bca9c474fd00dcc9/tplant-3.1.2.tgz --------------------------------------------------------------------------------