Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dcastil committed Aug 20, 2023
1 parent a22219d commit 8c86919
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 34 deletions.
50 changes: 28 additions & 22 deletions tests/extend-tailwind-merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { extendTailwindMerge } from '../src'
test('extendTailwindMerge works correctly with single config', () => {
const tailwindMerge = extendTailwindMerge({
cacheSize: 20,
classGroups: {
fooKey: [{ fooKey: ['bar', 'baz'] }],
fooKey2: [{ fooKey: ['qux', 'quux'] }, 'other-2'],
otherKey: ['nother', 'group'],
},
conflictingClassGroups: {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
extend: {
classGroups: {
fooKey: [{ fooKey: ['bar', 'baz'] }],
fooKey2: [{ fooKey: ['qux', 'quux'] }, 'other-2'],
otherKey: ['nother', 'group'],
},
conflictingClassGroups: {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
},
})

Expand All @@ -34,14 +36,16 @@ test('extendTailwindMerge works corectly with multiple configs', () => {
const tailwindMerge = extendTailwindMerge(
{
cacheSize: 20,
classGroups: {
fooKey: [{ fooKey: ['bar', 'baz'] }],
fooKey2: [{ fooKey: ['qux', 'quux'] }, 'other-2'],
otherKey: ['nother', 'group'],
},
conflictingClassGroups: {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
extend: {
classGroups: {
fooKey: [{ fooKey: ['bar', 'baz'] }],
fooKey2: [{ fooKey: ['qux', 'quux'] }, 'other-2'],
otherKey: ['nother', 'group'],
},
conflictingClassGroups: {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
},
},
(config) => ({
Expand Down Expand Up @@ -105,12 +109,14 @@ test('extendTailwindMerge works correctly with function config', () => {
test('extendTailwindMerge overrides and extends correctly', () => {
const tailwindMerge = extendTailwindMerge({
cacheSize: 20,
classGroups: {
shadow: ['shadow-100', 'shadow-200'],
customKey: ['custom-100'],
},
conflictingClassGroups: {
p: ['px'],
override: {
classGroups: {
shadow: ['shadow-100', 'shadow-200'],
customKey: ['custom-100'],
},
conflictingClassGroups: {
p: ['px'],
},
},
extend: {
classGroups: {
Expand Down
26 changes: 14 additions & 12 deletions tests/merge-configs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ test('mergeConfigs has correct behavior', () => {
{
separator: '-',
prefix: undefined,
theme: {
themeToOverride: ['overridden'],
},
classGroups: {
groupToOverride: ['I', 'overrode', 'you'],
groupToOverride2: undefined!,
},
conflictingClassGroups: {
toOverride: ['groupOverridden'],
},
conflictingClassGroupModifiers: {
toOverride: ['overridden-2'],
override: {
theme: {
themeToOverride: ['overridden'],
},
classGroups: {
groupToOverride: ['I', 'overrode', 'you'],
groupToOverride2: undefined!,
},
conflictingClassGroups: {
toOverride: ['groupOverridden'],
},
conflictingClassGroupModifiers: {
toOverride: ['overridden-2'],
},
},
extend: {
classGroups: {
Expand Down

0 comments on commit 8c86919

Please sign in to comment.