Files
grafana/public/app/features/query-library/api/mappers.test.ts
T
KristinaandPiotr Jamroz 0aaf820fd9 Explore / Query Library : Show user data (#88258)
* Add basic button for adding a query template

* Add hook to create a template

* Handle notifications

* Add tags to invalidate cache

* Generate translations

* Updates types

* Add tests

* Simplify code

* Add user to type

* Add a better default title

* bring in piotrs pr and try to add user data

* Move out of metadata (reserved in k8s) and make new values exportable

* Show user data

* Fix bad merge

* WIP

* Add annotation data to FE

* add (failing) test

* Fix types and test

* Cleanup

* Enhance user data and send to component for display

* Fix type

* Fix expected values

* fix betterer

* Fix test

* Remove user lookup

* testing slug usage for api

* Revert "testing slug usage for api"

This reverts commit cc4556c3b7.

* change types, display userid if login isnt returned

* Simply display whatever is in property

* skip test on removed logic

* Try waiting for query to finish before eval

* Revert "Try waiting for query to finish before eval"

This reverts commit 6220cabd17.

* Handle attribute not existing when storage type is file

---------

Co-authored-by: Piotr Jamroz <pm.jamroz@gmail.com>
2024-06-27 09:46:49 -05:00

19 lines
731 B
TypeScript

import { parseCreatedByValue } from './mappers';
describe.skip('mappers', () => {
describe('parseCreatedByValue', () => {
it.each`
value | expected
${''} | ${undefined}
${'api-key:1'} | ${{ userId: 1 }}
${'service-account:1:admin'} | ${{ userId: 1, login: 'admin' }}
${'user:1:admin'} | ${{ userId: 1, login: 'admin' }}
${'anonymous:0'} | ${undefined}
${'render:0'} | ${undefined}
${':0'} | ${undefined}
`("parsing '$value' should be '$expected'", ({ value, expected }) => {
expect(parseCreatedByValue(value)).toEqual(expected);
});
});
});