mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
b1c4f3aec4
- Implements Lerna - Moves all source code into `packages/next` - Keeps integration tests in the root directory
31 lines
833 B
JavaScript
31 lines
833 B
JavaScript
/* global describe, it, expect */
|
|
import { Component } from 'react'
|
|
import { getDisplayName } from 'next/dist/lib/utils'
|
|
|
|
describe('getDisplayName', () => {
|
|
it('gets the proper display name of a component', () => {
|
|
class ComponentOne extends Component {
|
|
render () {
|
|
return null
|
|
}
|
|
}
|
|
|
|
class ComponentTwo extends Component {
|
|
static displayName = 'CustomDisplayName'
|
|
render () {
|
|
return null
|
|
}
|
|
}
|
|
|
|
function FunctionalComponent () {
|
|
return null
|
|
}
|
|
|
|
expect(getDisplayName(ComponentOne)).toBe('ComponentOne')
|
|
expect(getDisplayName(ComponentTwo)).toBe('CustomDisplayName')
|
|
expect(getDisplayName(FunctionalComponent)).toBe('FunctionalComponent')
|
|
expect(getDisplayName(() => null)).toBe('Unknown')
|
|
expect(getDisplayName('div')).toBe('div')
|
|
})
|
|
})
|