-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat #81 - Address PR Comments, rebase dev
- Loading branch information
1 parent
af50432
commit f2b8bc7
Showing
9 changed files
with
117 additions
and
44 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react' | ||
import { mount, ReactWrapper } from 'enzyme' | ||
import TreeSkeleton, { SkeletonTreeNode } from '../TreeSkeleton' | ||
|
||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
namespace jest { | ||
interface Matchers<R> { | ||
toBeWithinRange(a: number, b: number): R | ||
} | ||
} | ||
} | ||
|
||
expect.extend({ | ||
toBeWithinRange(received, floor, ceiling) { | ||
const pass = received >= floor && received <= ceiling | ||
if (pass) { | ||
return { | ||
message: () => | ||
`expected ${received} not to be within range ${floor} - ${ceiling}`, | ||
pass: true | ||
} | ||
} else { | ||
return { | ||
message: () => | ||
`expected ${received} to be within range ${floor} - ${ceiling}`, | ||
pass: false | ||
} | ||
} | ||
} | ||
}) | ||
|
||
let wrapper: ReactWrapper | ||
|
||
beforeEach(() => { | ||
wrapper = mount(<TreeSkeleton blockCount={3} />) | ||
}) | ||
|
||
describe('TreeSkeleton', () => { | ||
it('renders', () => { | ||
expect(wrapper.find(TreeSkeleton)).toHaveLength(1) | ||
}) | ||
|
||
it('renders correct number of SkeletonTreeNodes within range', () => { | ||
expect(wrapper.find(SkeletonTreeNode).length).toBeWithinRange(9, 15) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters