Skip to content

Commit

Permalink
DEV tableHelpers
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Aug 11, 2022
1 parent 9f9ff67 commit 04baec1
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`TableHelpers generateTableKey should generate a variety of unique keys: keys 1`] = `
Object {
"func": "table-() => 'lorem'",
"nan": "table-generatedid-",
"null": "table-generatedid-",
"number": "table-200",
"obj": "table-{\\"lorem\\":\\"ipsum\\"}",
"repeatNumber": "generatedid-",
"string": "table-lorem",
"undefined": "table-generatedid-",
}
`;

exports[`TableHelpers should have specific functions: tableHelpers 1`] = `
Object {
"generateTableKey": [Function],
"tableHeader": [Function],
"tableRows": [Function],
}
`;
20 changes: 20 additions & 0 deletions src/components/table/__tests__/tableHelpers.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { tableHelpers, generateTableKey, tableHeader, tableRows } from '../tableHelpers';

describe('TableHelpers', () => {
it('should have specific functions', () => {
expect(tableHelpers).toMatchSnapshot('tableHelpers');
});

it('generateTableKey should generate a variety of unique keys', () => {
expect({
string: generateTableKey('lorem'),
func: generateTableKey(() => 'lorem'),
obj: generateTableKey({ lorem: 'ipsum' }),
null: generateTableKey(null),
undefined: generateTableKey(undefined),
nan: generateTableKey(NaN),
number: generateTableKey(200),
repeatNumber: generateTableKey(200)
}).toMatchSnapshot('keys');
});
});

0 comments on commit 04baec1

Please sign in to comment.