user extensions test

This commit is contained in:
Jesper Møller Jensen
2022-11-21 22:00:38 +01:00
parent 9d507daf69
commit 5cdcc2bd5d

View File

@@ -0,0 +1,22 @@
import { expect, fixture, html } from '@open-wc/testing';
import { InterfaceColor, InterfaceLook } from '@umbraco-ui/uui-base/lib/types';
import type { UserStatus } from './user-extensions';
import { getTagLookAndColor } from './user-extensions';
describe('UmbUserExtensions', () => {
it('returns correct look and color from a status string', () => {
const testCases: { status: UserStatus; look: InterfaceLook; color: InterfaceColor }[] = [
{ status: 'enabled', look: 'primary', color: 'positive' },
{ status: 'inactive', look: 'primary', color: 'warning' },
{ status: 'invited', look: 'primary', color: 'warning' },
{ status: 'disabled', look: 'primary', color: 'danger' },
];
testCases.forEach((testCase) => {
const { look, color } = getTagLookAndColor(testCase.status);
expect(look).to.equal(testCase.look);
expect(color).to.equal(testCase.color);
});
});
});