Skip to content

Commit

Permalink
add tests for bahmutov#8
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Dec 14, 2021
1 parent e86c518 commit aa4d061
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions test/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,77 @@ test('typescript', (t) => {
],
})
})

test('typescript 2', (t) => {
t.plan(1)
const source = stripIndent`
describe('TypeScript spec', () => {
it('works', () => {
const person = {
name: 'Joe',
}
cy.wrap(person).should('have.property', 'name', 'Joe')
})
it('loads', () => {
const n: number = 1
cy.wrap(n).should('eq', 1)
})
})
`
const result = getTestNames(source)

t.deepEqual(result, {
suiteNames: ['TypeScript spec'],
testNames: ['loads', 'works'],
tests: [
{
name: 'works',
},
{
name: 'loads',
},
{
name: 'TypeScript spec',
},
],
})
})

// SKIP: https://github.com/bahmutov/find-test-names/issues/8
test.skip('typescript interface', (t) => {
t.plan(1)
const source = stripIndent`
interface Person {
name: string
}
`
const result = getTestNames(source)

t.deepEqual(result, {})
})

// SKIP: https://github.com/bahmutov/find-test-names/issues/8
test.skip('typescript type', (t) => {
t.plan(1)
const source = stripIndent`
type Person = {
name: string
}
`
const result = getTestNames(source)

t.deepEqual(result, {
suiteNames: ['foo'],
testNames: ['bar'],
tests: [
{
name: 'bar',
},
{
name: 'foo',
},
],
})
})

0 comments on commit aa4d061

Please sign in to comment.