Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138221

Jest how to make sure I get back a string value?

$
0
0

I have a test that returns a token.

I can not match the token because i get back a unique token ever time.

I am looking for a method/way to make sure I always get back a stiring.

code so far:

describe('getUser', () => {
  it('get user from ICM', async () => {
    const data: IFindCustomerPayload = {
      cardNr: 'carNumber',
      lastName: 'John1',
      zipcode: '10117',
      dateOfBirth: '1984-03-01',
    };
    const resp = await findProfile(data, 'DE'); // returns a token

    expect(resp).toHaveLength(more than 1? ); // make sure it is a string as long it is not empty
  });
});

Viewing all articles
Browse latest Browse all 138221

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>