-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support generating values with faker.js in scripting
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/insomnia-sdk/src/objects/__tests__/environments.test.ts
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,24 @@ | ||
import { describe, expect, it } from '@jest/globals'; | ||
import { validate } from 'uuid'; | ||
|
||
import { Environment, Variables } from '../environments'; | ||
|
||
describe('test Variables object', () => { | ||
it('test basic operations', () => { | ||
const variables = new Variables({ | ||
globals: new Environment('globals', { value: '777' }), | ||
environment: new Environment('environments', {}), | ||
collection: new Environment('baseEnvironment', {}), | ||
data: new Environment('iterationData', {}), | ||
}); | ||
|
||
const uuidAnd777 = variables.replaceIn('{{ $randomUUID }}{{value }}'); | ||
expect(validate(uuidAnd777.replace('777', ''))).toBeTruthy(); | ||
|
||
const uuidAndBrackets1 = variables.replaceIn('{{ $randomUUID }}}}'); | ||
expect(validate(uuidAndBrackets1.replace('}}', ''))).toBeTruthy(); | ||
|
||
const uuidAndBrackets2 = variables.replaceIn('}}{{ $randomUUID }}'); | ||
expect(validate(uuidAndBrackets2.replace('}}', ''))).toBeTruthy(); | ||
}); | ||
}); |
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