luhn-generator
Version:
A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm
72 lines (69 loc) • 1.9 kB
JavaScript
/* eslint-env jest */
import getComputedRole from '../../../src/util/getComputedRole';
import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock';
describe('getComputedRole', () => {
describe('explicit role', () => {
describe('valid role', () => {
it('should return the role', () => {
expect(getComputedRole(
'div',
[JSXAttributeMock('role', 'button')],
)).toBe('button');
});
});
describe('invalid role', () => {
describe('has implicit', () => {
it('should return the implicit role', () => {
expect(getComputedRole(
'li',
[JSXAttributeMock('role', 'beeswax')],
)).toBe('listitem');
});
});
describe('lacks implicit', () => {
it('should return null', () => {
expect(getComputedRole(
'div',
[JSXAttributeMock('role', 'beeswax')],
)).toBeNull();
});
});
});
describe('no role', () => {
describe('has implicit', () => {
it('should return the implicit role', () => {
expect(getComputedRole(
'li',
[],
)).toBe('listitem');
});
});
describe('lacks implicit', () => {
it('should return null', () => {
expect(getComputedRole(
'div',
[],
)).toBeNull();
});
});
});
});
describe('implicit role', () => {
describe('has implicit', () => {
it('should return the implicit role', () => {
expect(getComputedRole(
'li',
[JSXAttributeMock('role', 'beeswax')],
)).toBe('listitem');
});
});
describe('lacks implicit', () => {
it('should return null', () => {
expect(getComputedRole(
'div',
[],
)).toBeNull();
});
});
});
});