Skip to content

Commit

Permalink
test: Cover default export type (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaachinman authored Aug 6, 2019
1 parent 322b90e commit e499b99
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
8 changes: 0 additions & 8 deletions __tests__/types.test.ts

This file was deleted.

24 changes: 24 additions & 0 deletions __tests__/types.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'

// Import all types to ensure they exist
import NextI18Next, {
AppWithTranslation,
Config,
I18n,
InitConfig,
TFunction,
WithTranslation,
} from '../types'

const DummyComponent = () => <div />

const emptyConfig = {
defaultLanguage: null,
otherLanguages: [],
}

// Instantiate instance and call methods upon it
const Instance = new NextI18Next(emptyConfig)
Instance.appWithTranslation(DummyComponent)
Instance.withTranslation('common')(DummyComponent)

5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"noEmit": true,
"lib": ["esnext", "dom"],
"jsx": "react"
}
},
"include": [
"__tests__/types.test.tsx"
]
}

0 comments on commit e499b99

Please sign in to comment.