Files
directus/packages/utils/shared/get-redacted-string.test.ts
ian 7aedf763c0 Redact env values in logs for Flows (#19513)
* Redact env values in revisions for Flows

* Add unit tests

* Create cold-maps-teach.md

* Redact string type envs only

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>

* Fix linting

* Update test for non-string env

* Ignore zero length strings

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>

* Add replacementFn to include key of redacted value

* Update cold-maps-teach.md

* Remove case insensitivity

* Update changeset

* Rework

* Add utils to changeset

* Add unit test

* Rename to getRedactedString and add REDACTED_TEXT

* Consistent naming

---------

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-08-25 10:14:35 +02:00

13 lines
351 B
TypeScript

import { describe, expect, it } from 'vitest';
import { getRedactedString } from './get-redacted-string.js';
describe('getRedactedString', () => {
it('redacts without a key', () => {
expect(getRedactedString()).toBe('--redacted--');
});
it('redacts with a key', () => {
expect(getRedactedString('A_KEY')).toBe('--redacted:A_KEY--');
});
});