These are chat archives for canjs/canjs

6th
Mar 2018
Ranjan Subbiah
@ranjanbuilds
Mar 06 2018 16:45

hey all, I'm using can-fixture ike this:

let randoProgress = chance.pickone(['exploration', 'design', 'construction', 'lighting', 'expansion']);
let stagesResponse = {
    stages: {
        progress: randoProgress
    },
    success: 1
}

Fixture('GET /json/internet/get_town_stages', function() {
    return stagesResponse;
});

And then I do some testing. But at some point I need to modify stagesReponse and test. What's the best way to do this?

Kevin Phillips
@phillipskevin
Mar 06 2018 17:06
can't you just modify it?
is there some reason that won't work? or are you just wondering if that's the best approach?
Ranjan Subbiah
@ranjanbuilds
Mar 06 2018 17:10
yeah, tried that and it was throwing an error, but I am realizing it might have more to do with chai as promised.
but also, yeah, is it the best way? Or should I be using https://canjs.com/doc/can-fixture.requestHandler.html. Was curious as to how to mock fail response.
Kevin Phillips
@phillipskevin
Mar 06 2018 18:27
I think either way is fine
https://canjs.com/doc/can-fixture.response.html has some examples of how to mock failures