Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI for sequential responses and request number response rule
- Add new button for sequential responses, redesign the responses menu (using grid to avoid layout issues) - add tests for both features - Add script to migrate test data files Closes #459
- Loading branch information
Guillaume
committed
May 5, 2021
1 parent
f0f9ef2
commit 7e27de5
Showing
41 changed files
with
2,318 additions
and
2,959 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const Migrations = require('@mockoon/commons').Migrations; | ||
const { readFileSync, writeFileSync } = require('fs'); | ||
const prettier = require('prettier'); | ||
const prettierConfig = require('../package.json').prettier; | ||
|
||
/** | ||
* Use this script to migrate the tests sample environments. See ../test/data/README.md for more information. | ||
*/ | ||
|
||
const files = [ | ||
'./test/data/basic-data/environments.json', | ||
'./test/data/environment-logs/environments.json', | ||
'./test/data/export/environments.json', | ||
'./test/data/export-openapi/environments.json', | ||
'./test/data/headers/environments.json', | ||
'./test/data/import/environments.json', | ||
'./test/data/import/openapi/references/aws-cloudfront-v3.json', | ||
'./test/data/import/openapi/references/aws-server-v3.json', | ||
'./test/data/import/openapi/references/custom-schema-no-prefix-v2.json', | ||
'./test/data/import/openapi/references/custom-schema-no-prefix-v3.json', | ||
'./test/data/import/openapi/references/custom-schema-v2.json', | ||
'./test/data/import/openapi/references/custom-schema-v3.json', | ||
'./test/data/import/openapi/references/datagov-v2.json', | ||
'./test/data/import/openapi/references/giphy-v2.json', | ||
'./test/data/import/openapi/references/github-v2.json', | ||
'./test/data/import/openapi/references/petstore-v2.json', | ||
'./test/data/import/openapi/references/petstore-v3.json', | ||
'./test/data/import/openapi/references/shutterstock-v3.json', | ||
'./test/data/import/openapi/references/slack-v2.json', | ||
'./test/data/import/openapi/references/youtube-v3.json', | ||
'./test/data/proxy/environments.json', | ||
'./test/data/responses-rules/environments.json', | ||
'./test/data/settings/environments.json', | ||
'./test/data/templating/environments.json', | ||
'./test/data/ui/environments.json' | ||
]; | ||
|
||
files.forEach((file) => { | ||
const environments = JSON.parse(readFileSync(file).toString()); | ||
|
||
console.log(`Starting migrating ${file}`); | ||
|
||
environments.forEach((environment) => { | ||
Migrations.forEach((migration) => { | ||
if (migration.id > environment.lastMigration) { | ||
migration.migrationFunction(environment); | ||
environment.lastMigration = migration.id; | ||
} | ||
}); | ||
}); | ||
|
||
writeFileSync( | ||
file, | ||
prettier.format( | ||
JSON.stringify(environments), | ||
Object.assign(prettierConfig, { | ||
parser: 'json' | ||
}) | ||
) | ||
); | ||
|
||
console.log(`Finished migrating ${file}`); | ||
}); |
Oops, something went wrong.