These are chat archives for FreeCodeCamp/HelpJavaScript

7th
Jan 2019
Brad
@bradtaniguchi
Jan 07 00:59
@jk025523 You should be able to figure out the answer, either thru trial an error, external resources, or reading the prompt very carefully. (Usually there are hints). The more difficult challenges are difficult enough where you need to understand the problem well enough, then implement a solution.
Rizwan Syed
@RizwanSyed357
Jan 07 08:07
thanks for that guys :)
tundeiness
@tundeiness
Jan 07 09:59
@JLuboff the expected behavior is that `if I click on the editor's red button the previewer should disappear and if I do the same for the previewers' red button the editor should disappear but I end up getting duplicates of either if i click on anyone.
Nate Mallison
@NJM8
Jan 07 11:07
@jk025523 Even professional devs with years of experience look things up everyday. There is simply too much to know about web development. The key skill is not knowing the answer to something but being able to find the answer, which you did! The "cheating" you did is basically what I get paid to do everyday. I've just gotten good enough at finding the answers and implementing solutions that it takes a lot less time to find the answer. So don't worry! Keep trucking and searching and learning. the barrier to a web dev job is a combination of knowing enough but also knowing enough about what you don't know so that you can find the answer.
Rizwan Syed
@RizwanSyed357
Jan 07 11:54
thanks a lot for that Nate. I appreciate the honesty and clarity of your response. This chatroom is so fab :)
tundeiness
@tundeiness
Jan 07 12:37
hi @NJM8 mind if you can help with a challenge?
Nate Mallison
@NJM8
Jan 07 13:20
@tundeiness I am back, what's up?
tundeiness
@tundeiness
Jan 07 13:37
@NJM8 Welcome back!! So I have this project : https://codepen.io/highness/pen/ebNYVX?editors=0010
There is an Editor pane and a previewer pane. I want these pane to behave differently when a red dot (upper right) on the panes are clicked one at a time. I want it in such a way that if I click the red button on the upper right of the editor pane the previewer should be hidden and if I click the red button on the upper right of the previewer pane the editor should be hidden. So far what I have in the codepen is what I have so far. and it's not working yet. mind if you can help?
Nate Mallison
@NJM8
Jan 07 13:44
Sorry I don't know a thing about React
tundeiness
@tundeiness
Jan 07 13:47
@NJM8 okay
Nate Mallison
@NJM8
Jan 07 13:47
:cry:
?
tundeiness
@tundeiness
Jan 07 13:48
@NJM8 dunno but let me check
Kaz Baig
@kbaig
Jan 07 13:48
@tundeiness You're treating showUp as a boolean everywhere but it's actually an array of booleans
tundeiness
@tundeiness
Jan 07 13:50
@kbaig that is not really the idea. I have reverted to the previous state do help check where the issue is. Thanks.
Tom
@moT01
Jan 07 13:52
@tundeiness you basically want it to toggle the two components? and only display one at a time
tundeiness
@tundeiness
Jan 07 13:53
@moT01 I want to be able to toggle the two components but at different times; like if I click the red button on the upper right of the editor pane the previewer should be hidden and if I click the red button on the upper right of the previewer pane the editor should be hidden.
Tom
@moT01
Jan 07 14:00
how about two buttons at the top, labelled previewer and editor that you can toggle them on an off, cause right now if the preview was hidden, and you want to hide the editor - you would need to show the preview before you can hide the editor
but if that's how you want to do it...
i might do something like this...
have a couple states in apps showEditor and showPreviewer or something like that, equal to true or false and render them based on it
Tom
@moT01
Jan 07 14:05
if(showEditor) <Editor />
if(showPreviewer) <Previewer />
Kaz Baig
@kbaig
Jan 07 14:14
@moT01 that's how I'd do it too
tundeiness
@tundeiness
Jan 07 14:19
@moT01 I had similar idea but it got lost in transit ( for lack of words to describe how I could not get to implement it very well) However what if I want the default state? that is both previewer and editor left without toggling the kind of condition to handle that is what I could not get to wrap my head around.
Tom
@moT01
Jan 07 14:22
I'm not sure what you're asking there
tundeiness
@tundeiness
Jan 07 14:23
@moT01 I mean how will I implement toggling back to default state? ( the question sounds repetitive right?)
Tom
@moT01
Jan 07 14:24
in order to change the state of apps from a button in one of the other components you need to pass in a function as props
(i'm pretty sure)...
so in apps...
function toggleEditor() {
  if(this.state.showEditor) {
    setState({ showEditor: false })
  } else {
    setState({ showEditor: true })
  }
}
tundeiness
@tundeiness
Jan 07 14:26
@moT01 yes as props in the child component
Tom
@moT01
Jan 07 14:26
then when rendering...
< Previewer toggleEditor=toggleEditor />
and in the previewer component you can use your dot.onClick, toggleEditor()
something like that I think
tundeiness
@tundeiness
Jan 07 14:30
@moT01 will try it out
Tom
@moT01
Jan 07 14:33
@kbaig that sound right?
Aditya
@ezioda004
Jan 07 14:38
Why not do:
this.setState(prevState => ({
  showEditor: !prevState.showEditor
}));
Jason Luboff
@JLuboff
Jan 07 16:08
Morning :wave:
Kaz Baig
@kbaig
Jan 07 16:10
:wave:
Jason Luboff
@JLuboff
Jan 07 16:10
Hey man hows it going?
Kaz Baig
@kbaig
Jan 07 16:11
Chillin. Playing Kingdom Hearts :smile:
Should be starting a project soon but...we'll see how that goes
Jason Luboff
@JLuboff
Jan 07 16:11
Nice nice
Christopher McCormack
@cmccormack
Jan 07 16:32
Morning!
Jason Luboff
@JLuboff
Jan 07 16:32
Howdy
Christopher McCormack
@cmccormack
Jan 07 16:33
@kbaig is there a new KH?
Kaz Baig
@kbaig
Jan 07 16:33
@cmccormack Almost. End of this month
Christopher McCormack
@cmccormack
Jan 07 16:34
neat. those games were pretty cool last I played them
such an odd concept but it worked
Jason Luboff
@JLuboff
Jan 07 16:35
I never played one.. I too thought the concept was odd when I first heard of the original but never pulled me in I guess
Christopher McCormack
@cmccormack
Jan 07 16:36
had fun gameplay, that's what matters to me most
@JLuboff @kbaig what are you up to today?
Jason Luboff
@JLuboff
Jan 07 16:39
Just fixed a SQL job issue. Going to be working on creating all my tests today for my routes and functions. Have a couple of computers to work on.. Yourself?
Kaz Baig
@kbaig
Jan 07 16:39
Probably starting my personal site in Gatsby. I had to send a recruiter a resume so I banged it out as a webpage last week. Might as well give it a front page at least
Christopher McCormack
@cmccormack
Jan 07 16:39
@kbaig redo it in latex yet? :D
@JLuboff sounds like fun! I'm increasingly believing testing is key to building a solid app
Had a change that failed Saturday night, need to dig into why
Jason Luboff
@JLuboff
Jan 07 16:40
I still have a lot to learn about testing and how to properly set them up, but they're definitely very valuable
Kaz Baig
@kbaig
Jan 07 16:41
Hah I've got a lot to learn before I'm willing to learn LaTex
I want to get to a point with testing where it saves me time in development, but that amount of devotion to it sounds intimidating
Also, I don't really see how it would save me time if I'm deciding requirements as I go along. Seems to make more sense if you have them all upfront
Christopher McCormack
@cmccormack
Jan 07 16:43
@kbaig maybe decide requirements ahead of time :)
Jason Luboff
@JLuboff
Jan 07 16:43
Well.. it can help during development such that you decide you need to create a function that will do XYZ. So first you create the test that expects that end result, then you can test against that ;)
Christopher McCormack
@cmccormack
Jan 07 16:43
even a minimum set of requirements for an MVP should be enough to get going
seriously, if you design the code around your tests, you'll probably write better code because you'll see how you should abstract it, have a better idea of what validations/error handling you need to use, etc...
Jason Luboff
@JLuboff
Jan 07 16:46
Hell... my goal is to simulate form submissions so I don't actually have to do them anymore lol
Kaz Baig
@kbaig
Jan 07 16:47
That sounds pretty good...but again, time
Jason Luboff
@JLuboff
Jan 07 16:48
You aren't currently working are you?
Kaz Baig
@kbaig
Jan 07 16:48
Nah but I am working on stuff
Christopher McCormack
@cmccormack
Jan 07 16:48
I would say testing actually saved me time on my last few projects because I didn't get lost in the weeds nearly as often, my tests reflected my user stories and I was able to keep knocking out features
Jason Luboff
@JLuboff
Jan 07 16:51
I concur (even though I haven't done that yet)
Kaz Baig
@kbaig
Jan 07 16:52
Fair enough. I'll prioritize it higher
Christopher McCormack
@cmccormack
Jan 07 16:54
my next project I have prioritized testing/user stories so I can finally keep track of what I'm doing instead of constantly jumping around
i think it will work out well
Jason Luboff
@JLuboff
Jan 07 17:00

Well.. thats odd. Accidentlly had

const url = `//${process.env.FILESERVER}`
const dir = check ? `//${url}/..`

...oddly enough.. it worked..but.. can't find the file/folder anywhere on the FILESERVER but you can still download the file when you click the view file button on the webpage lol

Christopher McCormack
@cmccormack
Jan 07 17:02
maybe magic? or caching?
Jason Luboff
@JLuboff
Jan 07 17:02
I dunno. I would have expected an error
Christopher McCormack
@cmccormack
Jan 07 17:07
maybe it's an issue with your view of the fileserver? maybe it's hidden?
Jason Luboff
@JLuboff
Jan 07 17:10
I even jumped onto the fileserver (synology) and couldn't find it lol
Not a big deal though
Kelechi Chinaka
@ke1echi
Jan 07 17:28
am trying to make the markdown previewer in js
@are there any good videos on it, before i start? @JLuboff @cmccormack
Christopher McCormack
@cmccormack
Jan 07 17:28
@ke1echi I would recommend just jumping into it after reading the React Docs
Jason Luboff
@JLuboff
Jan 07 17:28
That was my first React project but was fairly straightforward
I :heart: USB 3... 30 GB backup in less than 5 minutes
Kelechi Chinaka
@ke1echi
Jan 07 17:29
i dont know enough react to build with it
tryna make it with vanilla js
Jason Luboff
@JLuboff
Jan 07 17:30
You're supposed to make it with React
Kelechi Chinaka
@ke1echi
Jan 07 17:31
i skipped the react session
maybe i will have to learn it after all
Christopher McCormack
@cmccormack
Jan 07 17:32

it's in the instructions:

You can use any mix of HTML, JavaScript, CSS, Bootstrap, SASS, React, Redux, and jQuery to complete this project. You should use a frontend framework (like React for example) because this section is about learning frontend frameworks

Kelechi Chinaka
@ke1echi
Jan 07 17:32
any good react tutorials you know of? @JLuboff
how do i get started with learning react? @cmccormack
Christopher McCormack
@cmccormack
Jan 07 17:33
@ke1echi I would go straight to the source first https://reactjs.org/docs/getting-started.html
Jason Luboff
@JLuboff
Jan 07 17:33
I went through FCC's React lessons and read the docs fairly often
Kelechi Chinaka
@ke1echi
Jan 07 17:34
thanks guys
Jason Luboff
@JLuboff
Jan 07 17:35
@cmccormack So..you back to work now?
Christopher McCormack
@cmccormack
Jan 07 17:35
yessir
Jason Luboff
@JLuboff
Jan 07 17:36
Any new projects for the year?
Christopher McCormack
@cmccormack
Jan 07 17:39
We have to build out our Untrusted SDWAN network this year, should be a fun one
Jason Luboff
@JLuboff
Jan 07 17:41
Sweet
Christopher McCormack
@cmccormack
Jan 07 17:44
yeah should be a fun challenge, that environment is so heterogenous there's always some gotcha somewhere
Jason Luboff
@JLuboff
Jan 07 17:44
Good deal. Always makes work better when you're challenged :)
Christopher McCormack
@cmccormack
Jan 07 17:48
Agree!
hoping to do more dev work this year
we're hiring a dev for our team as well
Jason Luboff
@JLuboff
Jan 07 17:49
App dev work?
Kelechi Chinaka
@ke1echi
Jan 07 17:56
how's the learning curve of react? @JLuboff @cmccormack
Christopher McCormack
@cmccormack
Jan 07 17:56
@ke1echi not too bad if you start slow and read the docs pretty closely
Jason Luboff
@JLuboff
Jan 07 17:56
The basics aren't too difficult..but.. it has taken me a while to really start to get it...and even now I'm only using the basics
Kelechi Chinaka
@ke1echi
Jan 07 17:58
how do you mean by start slow @cmccormack
Christopher McCormack
@cmccormack
Jan 07 18:00
@ke1echi don't try to rush into it, read the docs and make tiny react projects of your own, like make simple text display, then add a few elements, etc...
Stevegolden12
@Stevegolden12
Jan 07 18:09
@ke1echi depends on how well you know vanilla JS, and even some HTML and CSS. For me, learning React made me have a better understanding of JavaScript.
Christopher McCormack
@cmccormack
Jan 07 18:10
@ke1echi it will also help to get an understanding of JSX, what it is and how it works. Many go into React and see a weird syntax and make a lot of assumptions, but understanding JSX really helps. https://reactjs.org/docs/react-without-jsx.html https://reactjs.org/docs/jsx-in-depth.html
Jason Luboff
@JLuboff
Jan 07 18:32
Github now has free private repos! Wooo!
Kaz Baig
@kbaig
Jan 07 18:33
Really?
Limits you on number of collaborators but thats not an issue for myself
Kaz Baig
@kbaig
Jan 07 18:35
It's still asking me to pay to make a repo private for now
Jason Luboff
@JLuboff
Jan 07 18:35
The sole reason I am using BitBucket is becuase of free private repos...looks like I might be moving back to Github
Hmm...same for me...maybe its not active yet
Chris
@crokita
Jan 07 18:36
The announcement came out before the launch. Looks like it will happen tomorrow
At least from the article I read from techcrunch
Kaz Baig
@kbaig
Jan 07 18:36
Due to a scheduling error, we published this story one day before the embargo lifted. This feature isn’t live yet, but Github will formally unveil it tomorrow. When that happens, we’ll update this post with a link to the official announcement
Brad
@bradtaniguchi
Jan 07 18:36
Seemed like that was published on the 5th tho
Kaz Baig
@kbaig
Jan 07 18:36
I figured "tomorrow" referred to yesterday since it was posted 2 days ago
Chris
@crokita
Jan 07 18:36
Ah. the one I read was posted today
Jason Luboff
@JLuboff
Jan 07 18:37
Either way...should be here soon :)
Kaz Baig
@kbaig
Jan 07 18:37
Should we be thanking Microsoft?
Christopher McCormack
@cmccormack
Jan 07 18:39
@kbaig yes
Jason Luboff
@JLuboff
Jan 07 18:39
Yup
Kaz Baig
@kbaig
Jan 07 18:39
dank mr microsoft
doot doot
Brad
@bradtaniguchi
Jan 07 18:40
You gotta ask github, did they have these features in development before the MS buyout? Or did MS pour in the cash/push GH to get it done after it haha?
Jason Luboff
@JLuboff
Jan 07 18:41
Anybody have a good article or two on how to create GOOD tests?
Brad
@bradtaniguchi
Jan 07 18:41
@JLuboff Your doing tests will the DB and the front-end at the same time right?
Jason Luboff
@JLuboff
Jan 07 18:42
@bradtaniguchi Route testing and function testing as of right now. Will probably end up doing React testing later as well
Brad
@bradtaniguchi
Jan 07 18:43
ok so backend testing, do your tests hit the DB or do you "fake it",(mocking, spies, blah)
Jason Luboff
@JLuboff
Jan 07 18:43
Haven't quite determined that. Right now I only have one route being tested (GET) that does make a DB call
Brad
@bradtaniguchi
Jan 07 18:53
Yea I'd decide what you would want to deal with first. Learning how to mock/spy/stub/fake parts of your code so you can effectivly test units of your code, or learn how to deal with side-effects of your code and test the integration between parts of the app.
Christopher McCormack
@cmccormack
Jan 07 18:54
@bradtaniguchi so let's say you wanted to test an endpoint with a db call - how would you mock the db call within the route?
do you need to fake the entire DB chain somehow so the app uses a mock db?
Brad
@bradtaniguchi
Jan 07 18:59
@cmccormack You should be able todo something like this: sandbox .stub(SearchRecords, 'testRequestFunc') .resolves({ data: result } as any);
Christopher McCormack
@cmccormack
Jan 07 18:59
I should?
Brad
@bradtaniguchi
Jan 07 18:59
Thats actual code I have that provides "fake-data"
Christopher McCormack
@cmccormack
Jan 07 18:59
what is that doing, exactly?
Jason Luboff
@JLuboff
Jan 07 19:00
And what test framework are you using?
Brad
@bradtaniguchi
Jan 07 19:00
@cmccormack When you call your code X that uses Y, Y returns fake stuff
@JLuboff This is mocha+chai, which is the older framework, I know jest has similar capability built in
Now if you actually did want to call the DB then that's fine, but you would want to "clean" the db regularly
Jason Luboff
@JLuboff
Jan 07 19:00
Ya.. jest has mocks but I still need to learn how they work hah
Brad
@bradtaniguchi
Jan 07 19:01
Yea mocks/fakes is where testing gets interesting. Stuff like dependency injection start showing their pros haha
Jason Luboff
@JLuboff
Jan 07 19:01

I was able to get the database open/close working which allowed my GET route to work

beforeAll(async () => {
  await sql;
});

afterAll(async () => {
  await sql.close();
});

Probably don't need the close to be async but eh..

Christopher McCormack
@cmccormack
Jan 07 19:04
don't you need to pass done to close or does that not matter for the ...All methods?
Brad
@bradtaniguchi
Jan 07 19:04
Yea not sure. One thing to consider when running against a real db is your tests should be ran often... so your DB is going to be working hard during that time. Optimally your BD is running on some god machine, or locally (your own machine) so you don't screw over someone else using the db
Jason Luboff
@JLuboff
Jan 07 19:04
Ya all dev is local to my machine including the DB
Brad
@bradtaniguchi
Jan 07 19:04
@cmccormack I don't think that matters, i've seen mixed results, but some test-runners are "smart" when your using an async pipe, where you don't need done.
But knowledge is fuzzy, but it seems like the rule is "meh maybe?" when you need done
Christopher McCormack
@cmccormack
Jan 07 19:05
if you get Uncaught Promise Exceptions or whatever, it's probably wrong lol
Jason Luboff
@JLuboff
Jan 07 19:06
Is that in reference to my above code?
Christopher McCormack
@cmccormack
Jan 07 19:06
yeah
Jason Luboff
@JLuboff
Jan 07 19:08
I haven;t seen any issue yet :shrug:
Christopher McCormack
@cmccormack
Jan 07 19:11
maybe because of async await
Jason Luboff
@JLuboff
Jan 07 19:11
Normally I just establish a single global connection to the database and leave it open. Had issues trying to open and close
Brad
@bradtaniguchi
Jan 07 19:19
@JLuboff The code your testing doesn't do that automatically byitself?
Jason Luboff
@JLuboff
Jan 07 19:19
@bradtaniguchi Open the DB connection?
Brad
@bradtaniguchi
Jan 07 19:44
The beforeAll is just at the test-script level right? So if you have multiple scripts it would befired multiple times when running all tests right?
Jason Luboff
@JLuboff
Jan 07 19:44
Ya
Right now I only have two test files.. one for routes and one for functions
I may not be writing good tests (still trying to figure out exactly what that entails heh) but this is definitely helping me refactor quite a bit
alpox
@alpox
Jan 07 20:45
@bradtaniguchi more optimally would be to run database targeted tests encapsulated in transactions without ever committing them and roll them back after every test. That makes the tests much faster as nothing gets written to disk
Jason Luboff
@JLuboff
Jan 07 20:46
@alpox :wave:
Brad
@bradtaniguchi
Jan 07 20:46
@alpox Never thought about that approach!, makes sense. I guess I still need to have a DB connection tho, even if I'm not technically "doing" anything to it right?
Jason Luboff
@JLuboff
Jan 07 20:46
Correct, still need the connection
Brad
@bradtaniguchi
Jan 07 20:47
@JLuboff You could always run some coverage software to see how much of the code your "testing", gives you a good idea of how much your actually covering.
alpox
@alpox
Jan 07 20:47
@bradtaniguchi Yes, the transaction state is kept in the database so you need the connection
Jason Luboff
@JLuboff
Jan 07 20:47
I feel like I read in the Jest docs that it has that...but....I could be wrong
alpox
@alpox
Jan 07 20:48
@JLuboff Yep it has pretty nice ones
@JLuboff jest --coverage :P
Jason Luboff
@JLuboff
Jan 07 20:50
Cool :) I'll have to look up what everything means though hah
alpox
@alpox
Jan 07 21:01
@JLuboff Can happen :D
Jason Luboff
@JLuboff
Jan 07 21:04
@alpox You have any good resources on writing good tests (both routes and function testing)
Brad
@bradtaniguchi
Jan 07 21:16
Id offer resouces, but all the ones I read where for mocha+chai or karma+jasmine+angular
otherwise its generic stuff id read over lunch like "how to write effective tests"
Jason Luboff
@JLuboff
Jan 07 21:18
@bradtaniguchi the mocha+chai ones should be fine. Shouldn't be difficult to convert to JEst
Brad
@bradtaniguchi
Jan 07 21:18
This is kinda funny, this was the second one that came up on google: https://medium.com/@jodylecompte/express-routes-a-tdd-approach-1e12a0799352
Doesn't that name look familar haha
This was the doc I started with when I started our project:
Jason Luboff
@JLuboff
Jan 07 21:24
The name of the author?
And thank you btw
Brad
@bradtaniguchi
Jan 07 21:24
@JLuboff It's jody, who used(or still is) to be here, looks to be a somewhat popular medium article too haha
Jason Luboff
@JLuboff
Jan 07 21:25
Ah...don't know if I've ever encountered him lol
Brad
@bradtaniguchi
Jan 07 21:29
Hmm, he was talkative on the old FCC general channel
Jason Luboff
@JLuboff
Jan 07 21:29
Ya I never went into general
Brad
@bradtaniguchi
Jan 07 21:29
and dropped in here time from time, he left with the discord chat group
haha makes sense then
Jason Luboff
@JLuboff
Jan 07 21:33
@bradtaniguchi How granular do you make each test? I.e do you have a seperate test/it for each individual test or group all tests into one block?
Brad
@bradtaniguchi
Jan 07 21:35
@JLuboff You can group tests into groups of tests using describe. The main goal would be to making the it message the it('MESSAGE GOES HERE' part make sense when running it, as that's what would show "failed". So something like:
describe('user routes', () => {
it('get users returns unathorized when no acess', () => {/**/})
})
would show up as a failure like this:
user routes - get users returns unauthorized when no access
Or something of the like, you should more or less know what sort of thing is failing, and have it group sensibly.
Jason Luboff
@JLuboff
Jan 07 21:37

Ya I get that, but something like this

  describe('GET route', () => {
    test('Should respond with 200, JSON, and an array of length 3', async () => {
      const res = await request(app).get('/newJSA');

      expect(res.status).toEqual(200);
      expect(res.type).toEqual('application/json');
      expect(res.body.length).toEqual(3);
      expect(Object.keys(res.body[0][0])).toEqual(expect.arrayContaining(['Hazard', 'Controls']));
      expect(Object.keys(res.body[1][0])).toEqual(
        expect.arrayContaining(['LocationID', 'LocationName']),
      );
      expect(Object.keys(res.body[2][0])).toEqual(
        expect.arrayContaining(['CompanyID', 'CompanyName']),
      );
    });
  });

versus

  describe('GET route', () => {
    test('Should respond with 200', async () => {
      const res = await request(app).get('/newJSA');

      expect(res.status).toEqual(200);
})
test ('should be JSON', () => {
      expect(res.type).toEqual('application/json');

      );
    });
  });
Brad
@bradtaniguchi
Jan 07 21:37
The other concern is re-using parts of your test-code, like you can re-use your stubs between tests for example
@JLuboff I would test only parts of your response, or 1 test-case
Jason Luboff
@JLuboff
Jan 07 21:38
Man I was failing at life there
Brad
@bradtaniguchi
Jan 07 21:38
@JLuboff Like what are the odds you will get back something OTHER-THAN `application/json'?
Jason Luboff
@JLuboff
Jan 07 21:38
:shrug: lol
Brad
@bradtaniguchi
Jan 07 21:39
Or the array is these exact 3 items, but then the array length is 4 things?
Jason Luboff
@JLuboff
Jan 07 21:39
Well if the array ends up being 4, I would want the test to fail as there should only be 3 objects in the array
Brad
@bradtaniguchi
Jan 07 21:39
Like your welcome to test those things, but i'd consider it overkill when you could be writing a test on multiple routes
@JLuboff Your checking for the three things explicity tho right?
Jason Luboff
@JLuboff
Jan 07 21:40
In the following lines.. ya
Brad
@bradtaniguchi
Jan 07 21:40
Like you should be able todo a deep equal for the entire body, which is clearer to understand and easier to write
Jason Luboff
@JLuboff
Jan 07 21:41
The response won't always be the same (i.e the object containing Company info will potentially expand)
Brad
@bradtaniguchi
Jan 07 21:43
Ok, sounds kinda nasty if the results being returned differs between tests, but that's how id want to test the app. Unless you only care about parts of the response. But yea, writing a test-case for each part of the response is to grandular, most will fail together (you wont get 200 if your data is not found for example)
Christopher McCormack
@cmccormack
Jan 07 21:45
yeah I wouldn't be that specific, maybe something like you get a successful response and the type is the correct type and any property that should be included is included
Jason Luboff
@JLuboff
Jan 07 21:46
Hmm alright
Brad
@bradtaniguchi
Jan 07 21:54
I swear..... when helping people that just say "its not working" :/
Jason Luboff
@JLuboff
Jan 07 21:55
So...code coverage is basically indicating how much of each file is used when the tests are ran?
Brad
@bradtaniguchi
Jan 07 21:56
@JLuboff More or less
Think of it as a rough estimate as how much of the code is "tested"
Jason Luboff
@JLuboff
Jan 07 21:56
Got it
This is pretty cool
Brad
@bradtaniguchi
Jan 07 21:58
Some create a web-site you can load up and view to go through your source code, and it shows the source and where tests are being ran.
Jason Luboff
@JLuboff
Jan 07 21:58
Yup, thats what Jest does :)
Brad
@bradtaniguchi
Jan 07 21:59
good, cuse its awesome :sunglasses: haha
Jason Luboff
@JLuboff
Jan 07 22:00
Ya it really is. So I see that I'm not testing one of my queries which.. I don't necessarily need to, but I can instead have it fail which should test my catch blocks
Brad
@bradtaniguchi
Jan 07 22:02
Yes you can. I usually don't test the catch blocks since they are all the same accross all routes (if something happens I just return some generic error)
Jason Luboff
@JLuboff
Jan 07 22:03
True. I just send status 500 but worth it to test at least one route to ensure that
Brad
@bradtaniguchi
Jan 07 22:06
Yes
Pagnito
@Pagnito
Jan 07 23:31
whaaaa, vs code has auto import update when u move files around, doooppppppppppeeeeee
Brad
@bradtaniguchi
Jan 07 23:34
@Pagnito That's been there for a few months I think. Takes a while to process when your changing more than a few files tho
Pagnito
@Pagnito
Jan 07 23:34
yea i notcied it only changes the file u move
still nice tho,
i been using atom like 90% of my whole time
i moved to vs code cuz my syntax coloring broke in atom
Brad
@bradtaniguchi
Jan 07 23:35
ew atom
Pagnito
@Pagnito
Jan 07 23:35
and it stayed broke after reinstallation
so i moved to vs code
and im really loving it
there is so many nice features
Jason Luboff
@JLuboff
Jan 07 23:35
Don't be an Atom hater haha
Christopher McCormack
@cmccormack
Jan 07 23:37
Microsoft Atom will be soon replaced with Microsoft VS Code, sources that don't exist say.
Jason Luboff
@JLuboff
Jan 07 23:38
:angry:
Brad
@bradtaniguchi
Jan 07 23:38
I'm a linux guy and when I first ran into VSCode I was like "Evil MS product!!!"
And used Atom... then Atom sucked all my ram, didn't support TS well
and like a number of other things were just eh
Been using VSCode for typescript, and found it's just straight up better. Sorry Atom your used less than sublime now :/
I heard github was working on a rust based editor a while back, with the goal being to "replace" atom. It was suppose to be faster than atom, but idk where it has gone
Christopher McCormack
@cmccormack
Jan 07 23:44
@bradtaniguchi so it would be native instead of electron?
Brad
@bradtaniguchi
Jan 07 23:44
Looks to still be electron based :/
but the "text-editor" part built ontop is faster it seems
or thats the goal at least
Christopher McCormack
@cmccormack
Jan 07 23:45
MS owns electron too now right? Native electron could be in the clouds which could enhance performance
Brad
@bradtaniguchi
Jan 07 23:50
Yea guess so XD