exercism/typescript

Exercise Palindrome Products - Automated tests time out (failing).

peerreynders opened this issue · 4 comments

Currently the automated tests are failing likely due to:

xtest('smallest palindrome from four digit factors', () => {
    const palindromes = generate({
      maxFactor: 9999,
      minFactor: 1000,
    })
    const smallest = palindromes.smallest
    const expected = { value: 1002001, factors: [[1001, 1001]] }

    expect(smallest.value).toEqual(expected.value)
    expect(sortFactors(smallest.factors)).toEqual(expected.factors)
  })

  test.skip('largest palindrome from four digit factors', () => {
    const palindromes = generate({
      maxFactor: 9999,
      minFactor: 1000,
    })
    const largest = palindromes.largest
    const expected = { value: 99000099, factors: [[9901, 9999]] }

    expect(largest.value).toEqual(expected.value)
    expect(sortFactors(largest.factors)).toEqual(expected.factors)
  })

I suspect that xtest is supposed to be test.skip as it can easily take 40 seconds to execute.

It may make sense to organize these tests in their own suite (or combine them into a single test to be skipped by default):

describe.skip('Palindromes from four digit factors', () => {
  test('smallest palindrome from four digit factors', () => {
    const palindromes = generate({
      maxFactor: 9999,
      minFactor: 1000,
    })
    const smallest = palindromes.smallest
    const expected = { value: 1002001, factors: [[1001, 1001]] }

    expect(smallest.value).toEqual(expected.value)
    expect(sortFactors(smallest.factors)).toEqual(expected.factors)
  })

  test('largest palindrome from four digit factors', () => {
    const palindromes = generate({
      maxFactor: 9999,
      minFactor: 1000,
    })
    const largest = palindromes.largest
    const expected = { value: 99000099, factors: [[9901, 9999]] }

    expect(largest.value).toEqual(expected.value)
    expect(sortFactors(largest.factors)).toEqual(expected.factors)
  })
})

Yesh. This makes sense. Want to make it a test.skip and get the rep?

See PR #742

closed by #742

There still is a problem. The analysis considers skipped tests as failed tests.