Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable insomnia.test and insomnia.expect in scripting - INS-3637 #7202

Merged
merged 4 commits into from
Mar 26, 2024

Conversation

ihexxa
Copy link
Contributor

@ihexxa ihexxa commented Mar 25, 2024

Changes:

  • enable insomnia.test and insomnia.expect in scripting, which follows chai assertion interfaces
  • added a smoke test for it
  • enable replaceIn for environments and variables

How to test:

Pls run this script and see its output in timeline:

insomnia.test('happy tests', () => {
  insomnia.expect(200).to.eql(200);
  insomnia.expect('uname').to.be.a('string');
  insomnia.expect('a').to.have.lengthOf(1);
  insomnia.expect('xxx_customer_id_yyy').to.include("customer_id");
  insomnia.expect(201).to.be.oneOf([201,202]);
  insomnia.expect(199).to.be.below(200);
  // test objects
  insomnia.expect({a: 1, b: 2}).to.have.all.keys('a', 'b');
  insomnia.expect({a: 1, b: 2}).to.have.any.keys('a', 'b');
  insomnia.expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd');
  insomnia.expect({a: 1}).to.have.property('a');
  insomnia.expect({a: 1, b: 2}).to.be.a('object')
    .that.has.all.keys('a', 'b');
});
insomnia.test('unhappy tests', () => {
  insomnia.expect(199).to.eql(200);
  insomnia.expect(199).to.be.oneOf([201,202]);
});

@ihexxa ihexxa self-assigned this Mar 25, 2024
@ihexxa ihexxa changed the title feat: enable insomnia.test and insomnia.expect in scripting feat: enable insomnia.test and insomnia.expect in scripting - INS-3637 Mar 25, 2024
@jackkav jackkav merged commit 38896f4 into develop Mar 26, 2024
7 checks passed
@jackkav jackkav deleted the pre-req-test branch March 26, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants