Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:04
    MylesBorins commented #1317
  • 09:04
    MylesBorins commented #1317
  • Jan 28 12:42
    sebamarynissen commented #1317
  • Jan 28 11:46
    codecov[bot] commented #1317
  • Jan 28 11:44
    codecov[bot] commented #1317
  • Jan 28 11:43
    sebamarynissen review_requested #1317
  • Jan 28 11:43
    sebamarynissen opened #1317
  • Jan 27 17:18
    greenkeeper[bot] commented #100
  • Jan 27 17:18

    greenkeeper[bot] on rollup-1.30.1

    chore(package): update rollup t… chore(package): update lockfile… (compare)

  • Jan 27 08:20
    greenkeeper[bot] commented #100
  • Jan 27 08:20

    greenkeeper[bot] on rollup-1.30.0

    chore(package): update rollup t… chore(package): update lockfile… (compare)

  • Jan 26 08:58
    greenkeeper[bot] commented #107
  • Jan 26 08:28
    codecov[bot] commented #1316
  • Jan 26 08:27
    codecov[bot] commented #1316
  • Jan 26 08:27
    codecov[bot] commented #1316
  • Jan 26 08:26
    codecov[bot] commented #1316
  • Jan 26 08:26
    codecov[bot] commented #1316
  • Jan 26 08:25

    greenkeeper[bot] on mocha-7.0.1

    chore(package): update mocha to… (compare)

  • Jan 26 08:23

    greenkeeper[bot] on mocha-7.0.1

    chore(package): update mocha to… chore(package): update lockfile… (compare)

  • Jan 26 08:22
    greenkeeper[bot] labeled #1316
sachinbreakingthings
@sachinbreakingthings
chai-http omits undefined key/value pairs from response body any one have answers why ?
Danny Large
@LifeInLarge_twitter
Anyone around?
Eric Eastwood
@MadLittleMods
@LifeInLarge_twitter Better to ask your question right away instead of waiting for someone to respond. Don't ask to ask, just ask
kenji
@kenji_rai_twitter
I'm unable to achieve should.fail,
const BigNumber = web3.BigNumber;
require('chai')
  //.use(require('chai-as-promised'))
  .use(require('chai-bignumber')(BigNumber))
  .should();

it("should fail", function() {
  should.fail(0, 1, "Didn't failed");
});
got this error "TypeError: should.all is not a function"
sorry this is the correct one "Error: Invalid Chai property: fail. Did you mean "all"?:
any advice
Keith Cirkel
@keithamus
should.fail is not a valid test I think
you might have meant should.throw but that test looks more like you want 0.should.not.equal(1)
Tiago Correia
@tiagocorreiaalmeida
im trying to test a post with image upload + body fields
https://pastebin.com/PDbAV27w
https://pastebin.com/bPnCMwch
for some reason the body reaches empty
any idea what im missing?
Andrea
@SchnuWu_twitter

Hello , I register the chai module in my wdio.conf.js file

require('chai/register-assert');

In my test file I write:

assert.equal(...);
assert.include(...);

For assert.equal I get a Warning in my IDE: require() call is missing

UncleGus
@UncleGus
hi, I'm looking for advice on testing API endpoints with chai-http
I want to do some negative testing, checking that certain endpoints return 404 or 401 etc.
but they cause the request to throw an error
what's the best way to handle that?
UncleGus
@UncleGus
ending up using .then and .catch and just flipping the resolve/reject
Ajmal Abdul Majeed
@ajmalmajeed
Hi there
im trying to use chai for my expect conditions, but thet functions done seem to be available even though i have installed the dependencies
im using appium webdriverio for my tests
any leads on how i can get chai setup successfully?
Lars Gyrup Brink Nielsen
@LayZeeDK
@ajmalmajeed I use this (TypeScript):
import * as chai from 'chai';

const expect: Chai.ExpectStatic = chai.expect;

expect(someCondition).to.be.true;
Ajmal Abdul Majeed
@ajmalmajeed
alright, thanks @LayZeeDK
Marc
@MarcNq
Hi @SchnuWu_twitter , normally this happens because of the linting. For example, eslint allows for a global field in .eslintrc config file where you can define the global variables you have. You can also add there "describe" and "it".

Hi guys,

anyone knows how long does it take for Chai to detect a new plugin in npm and add it to the official list in https://www.chaijs.com/plugins/ ?

rifkinurgraha1
@rifkinurgraha1
hi anyone know, when i use should, appear 'Error: Invalid Chai property: __wd_promise_enriched'
philicia
@tirzahtoh_twitter
how can I use chai http to send http request? I got a curl command curl -H "Content-Type: application/json" -X POST -d '{"voiceFilePath":"https://api.voicerss.org/?key=8593c9ec738c4059963f15c139d9f41f&src=%22basf%22&hl=en-us&c=wav"}' http://10.12.10.36:9090/load/ and I expect this output: {"status":"SUCCESS","message":"Loaded","voiceFilePath":"6030039c-5626-47f9-8fde-ccb17c3d9b17.wav","recordingDuration":0,"audioData":null}

my code snippet: function callAPIHelper(endpoint, input) {
const chai = require('chai');

const serverUrl = xlVAServer[0].ServerURL;
const payload = {
voiceFilePath: input
}

chai.request(serverUrl)
.post(endpoint)
.set('Content-Type', 'application/json')
.send(payload)
.expect(200)
.expect((res) => {
expect(res, body.text).toBe(payload)
});

but I got this error:chai.request is not a function
Larbi Jirari
@laroox
hello i'd like to test an api on https, how can i add certificate ?
Error: write EPROTO 139638903605056:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1528:SSL alert number 40
Yaser Moradi
@ysmoradi
Interesting repo => Mocha + TypeScript + Chai
https://github.com/ysmoradi/mocha-chai-ts-starter
Jacopo
@JacopoBonta_gitlab
Hi all, i'm trying to test a node.js class that extends EventEmitter but the test returns ok even before the event is fired. Why this happen? Maybe there is a proper way to test data emitted by events.
Here is the test code, basically it have to validate a json emitted on the tick event.
const chai = require('chai')
chai.use(require('chai-json-schema'))

const { expect } = chai

const RideSimulator = require('../src/RideSimulator')

describe('RideSimulator run()', () => {
    it('should return a json compliant to the schema', () => {

        let schema = { ... schema omitted ... }

        let ride = new RideSimulator(1, 1)

        ride.on('tick', (busData) => {
            expect(busData).to.be.jsonSchema(schema)
        })
    })
})
Jacopo
@JacopoBonta_gitlab
I found a solution here https://stackoverflow.com/questions/16826352/whats-the-best-way-to-unit-test-an-event-being-emitted-in-nodejs
walternolak
@walternolak
Hello! I’m trying to use chainable getter AND. Not sure if this syntax is correct: expect(someCondition).to.be.true.and.expect(otherCondition).to.be.false
If not what would be the correct one using AND
Thanks in advance!!
Kwirke
@kwirke
Hi @walternolak ,
When you concatenate assertions with .and, you are still referring to the same test subject, so you can't chain another expect. Instead, do a new line and have two separate assertions beginning with expect()
Bonus points if you make it as two different tests (it block) because that's a recommended good practice for clarity: One assertion per test
walternolak
@walternolak
@kwirke Understood! thanks for your response.
philicia
@tirzahtoh_twitter
Hi how do I use chai to compare with the expected nested json such as this: const expectedJson = { "authToken": "eyJraWQiOiJVdEI4c0hhYnk0aXBLNlwvQTZnaHBkRFFqRU9tdlptSnZZQTJpNFwvM2w3UmM9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIyMTVhMGVhZS00ZjkwLTRlODItOWY4Zi1lNzhlOTdkMzcyODAiLCJldmVudF9pZCI6ImVkNGY5MDJmLTFhM2UtNDRkYy1hNjg2LWY3ZjVjZDM3ODA5OCIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE1NjUwOTk1OTAsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC51cy1lYXN0LTIuYW1hem9uYXdzLmNvbVwvdXMtZWFzdC0yX2EzbE5SRU5QMSIsImV4cCI6MTU2NTEwMzE5MCwiaWF0IjoxNTY1MDk5NTkxLCJqdGkiOiJkMjY4YjRkMi01ZWVhLTQ4OGItODUyZi1lNGM4MWRmMWFiYzMiLCJjbGllbnRfaWQiOiI2Z2xwbmRxb2s2YWhua3M2dGFnNXQ5cGMwZyIsInVzZXJuYW1lIjoicWFAdGVsZXBhdGh5LmFpIn0.UlN9bucJbjS4nT8Ly0m9zKRctkyLp9hyIVt9v2l4GdyYptOAvPC3nJl3NrVJGRICAVXRZgswWqCDfifxYUaQ64XGNCrCkLMQ9ecgsNK5ZMuFl7ebl5m1bs3FZTyD-c2fAlzRlAGlLe5ADFN-IPBDI_lmkqd3bhA9wxPrPR7uc7HOl_rjUgsqDd0saO0OPw4AmGpuSqeT56XHoc_IuPUwk6KdPEJ4kO5pIz0hw__QNspMBsoOUrH1pt4TYD9dYTMyrFGJNhPDElJBrxFpGR1TIO7eiXAc_-8z-dhEY4Ek8fyPK8ULqEyk-0UD7QgXCe6TgqdD5jBVTB3aHTYpzn2gLg", "clientInfo": { "clientId": "0d6fc71d-46ff-4441-904f-9f5fd36a43a2" } }
Isabel Giang
@hollowsunsets
hello, I'm trying to test some asynchronous functions to see if they throw errors when expected
i've read that you no longer need chai-as-promised to do this
do you know what exactly I'd need to change? this is what I have right now and i'm not sure if it's correct syntactically
await expect(object.classMethod()).to.eventually.be.rejectedWith(TypeError, "errorMessage");
Dan Čermák
@dcermak
Is there a simple way how I can make a plugin "return a value" from an assertion chain?
for example, let's say I have this chain ctx.should.do.foo(barFuncThatReturnsSmth) and I'd like this chain to return the return value of barFuncThatReturnsSmth
I have tried to override this._obj in the definition of the method foo, but that didn't work. The object is there, but is not returned directly (it's hidden inside some __flags object)
DJ Tinkers
@TinkersDj_twitter

Anyone interested in an opensource project?

Spec oriented development speeds up programming by generating code based on tests/specs. Tests required will be the same or less specs as a normal developer writes.

https://github.com/Neur0plasticity/spec-dev

MSG me if interested

Sven Murat
@sven14_gitlab

is it possible to pass true or false as argument, e.g.

    expect(
      selector.isEnabled(),
      "msg",
    ).to.be.(Enabled)

where Enabled is true or false?

Eric Eastwood
@MadLittleMods
@sven14_gitlab Yes, you can use expect(selector.isEnabled()).to.be.(true)