These are chat archives for ecjs/Concierge

18th
Nov 2014
Chareesa Graham
@Chareesa
Nov 18 2014 00:08 UTC
When Heroku crashed, what I used to reboot:
heroku ps:scale web=2
Joe Elsey
@joeelsey
Nov 18 2014 00:28 UTC
app crashed.
Mark Harrell
@ecjs
Nov 18 2014 00:29 UTC
From what...look at heroku logs
Joe Elsey
@joeelsey
Nov 18 2014 00:31 UTC
Can't set headers after they are sent. Looking to see what file its doing it in.
Joe Elsey
@joeelsey
Nov 18 2014 00:36 UTC
works again
checking to see if I can create a user
Joe Elsey
@joeelsey
Nov 18 2014 00:43 UTC
works. weird. header error gone.
was able to create two new users in rapid succession
Going to try and create a user while I'm running the mongo server from my terminal.
I am creating new users with my phone number. No confirmation codes so far from twilio
crashed again. I think there is a connection between accessing the mongo server locally and trying to run the app at the same time.
Mark Harrell
@ecjs
Nov 18 2014 00:48 UTC
your local mongo
shouldnt really have anything to do with this
I think that its most likely a database issue
as in..duplicate keys or something
I think I know where the problem is
going to update something now
Joe Elsey
@joeelsey
Nov 18 2014 00:49 UTC
cool
btw I was able to create an entirely duplicate user. by accident
Mark Harrell
@ecjs
Nov 18 2014 00:49 UTC
yah, I dont necessarily think thats the issue
but ya
validation
if Users.find({username: req.body.username}) return GTFO
or something like that
ok
so there is two res.send(err)
in register_user.js
thats that the sending headers issue is from
wait that might not be it
let me try and replicate
Joe Elsey
@joeelsey
Nov 18 2014 00:55 UTC
So
Its up again with no changes
Mark Harrell
@ecjs
Nov 18 2014 00:56 UTC
what is
Joe Elsey
@joeelsey
Nov 18 2014 00:56 UTC
The app
Mark Harrell
@ecjs
Nov 18 2014 00:56 UTC
going to try and replicate some errors
Joe Elsey
@joeelsey
Nov 18 2014 00:56 UTC
I'm wondering if there's an uncaught exception crashing the app. How the app is restarting is something I can't figure out.
Mark Harrell
@ecjs
Nov 18 2014 00:56 UTC
can you look at your heroku logs
you need to trace the error to the line
thats causing it
Joe Elsey
@joeelsey
Nov 18 2014 00:57 UTC
Heroku logs gives me the content header error and points to register_user.js
24:29
Mark Harrell
@ecjs
Nov 18 2014 00:57 UTC
hmm
Joe Elsey
@joeelsey
Nov 18 2014 00:57 UTC
ah
got it
sending the same user twice creates the error
Mark Harrell
@ecjs
Nov 18 2014 00:58 UTC
but we arent doing that
those are two diff errors
Joe Elsey
@joeelsey
Nov 18 2014 00:58 UTC
I just did it
to test
I created a user. It worked. I then posted the same user again and crashed
I too enjoy breaking code.
looking at the logs now
Mark Harrell
@ecjs
Nov 18 2014 00:59 UTC
ahh
I see the problem.
so what happens is
there is an error saving the user to the database..
but, we dont find out what that error is(potentially), because it tries to res.json outside of that
the user generated token
we might have to nest that in an else statement
or something like that
Joe Elsey
@joeelsey
Nov 18 2014 01:00 UTC
I moved it back in once
Mark Harrell
@ecjs
Nov 18 2014 01:00 UTC
let me try and fix this a little bit
Joe Elsey
@joeelsey
Nov 18 2014 01:00 UTC
I got the could not send confirmation code
Mark Harrell
@ecjs
Nov 18 2014 01:00 UTC
either way, the problem is most likely from duplicate users
Joe Elsey
@joeelsey
Nov 18 2014 01:01 UTC
I moved it out again and it let me create a user
Mark Harrell
@ecjs
Nov 18 2014 01:01 UTC
every time you create a user
you might want to drop your database
or user a diff username
but I dont think thats what it is
because we dont require a unique username
Joe Elsey
@joeelsey
Nov 18 2014 01:01 UTC
well I shouldn't be able to create a new user or we should catch the error and not crash
Mark Harrell
@ecjs
Nov 18 2014 01:01 UTC
let me spend a few minutes debugging this
Joe Elsey
@joeelsey
Nov 18 2014 01:02 UTC
cool
Mark Harrell
@ecjs
Nov 18 2014 01:05 UTC
joe have you still not received a text
from the app
Joe Elsey
@joeelsey
Nov 18 2014 01:05 UTC
nope
Mark Harrell
@ecjs
Nov 18 2014 01:05 UTC
drop the database
and use this
{"username":"mark2243",
"password":"password123",
"phone":"3607393580",
"name":{"first":"mark","last":"harrell"}
}
except
change my number out for yours
{"username":"mark2243",
 "password":"password123",
 "phone":"3607393580",
 "name":{"first":"mark","last":"harrell"}
}
Joe Elsey
@joeelsey
Nov 18 2014 01:06 UTC
db has been dropped
Mark Harrell
@ecjs
Nov 18 2014 01:06 UTC
and by db I meant your user collection in mongloabs
mongolabs*
Joe Elsey
@joeelsey
Nov 18 2014 01:07 UTC
yep
db.users.drop()
Mark Harrell
@ecjs
Nov 18 2014 01:07 UTC
are you logged into
terminak
terminal*/shell
Joe Elsey
@joeelsey
Nov 18 2014 01:07 UTC
Yes.
Mark Harrell
@ecjs
Nov 18 2014 01:07 UTC
got it
Joe Elsey
@joeelsey
Nov 18 2014 01:07 UTC
Should I close the db?
the terminal that is? Heroku app hasn't reset yet like last time.
Mark Harrell
@ecjs
Nov 18 2014 01:07 UTC
no
the only thing you should be doing
Joe Elsey
@joeelsey
Nov 18 2014 01:08 UTC
I should be able to stay logged into the db.
Mark Harrell
@ecjs
Nov 18 2014 01:08 UTC
yes
the only thing you need to be doing is dropping the user collection
I do it from mongolab.com
Joe Elsey
@joeelsey
Nov 18 2014 01:08 UTC
I do it from terminal
Mark Harrell
@ecjs
Nov 18 2014 01:10 UTC
db.users.drop() should be sufficient
Joe Elsey
@joeelsey
Nov 18 2014 01:10 UTC
app is still down. post didn't go through.
Mark Harrell
@ecjs
Nov 18 2014 01:10 UTC
why is the app down..
Joe Elsey
@joeelsey
Nov 18 2014 01:10 UTC
checking the logs
don't know.
headers again
let me try something.
Mark Harrell
@ecjs
Nov 18 2014 01:10 UTC
its a duplicate user issue or something
dunno
very odd
Joe Elsey
@joeelsey
Nov 18 2014 01:11 UTC
nah. i'm using the info you gave me
Mark Harrell
@ecjs
Nov 18 2014 01:11 UTC
oh
ya..it sent me a confirmation number
:)
something is changed on your file locally maybe
did you not change the phone number
its adding it to your database
its working fine over here for me
Joe Elsey
@joeelsey
Nov 18 2014 01:12 UTC
ok
Mark Harrell
@ecjs
Nov 18 2014 01:13 UTC
make sure you have content-type application/json
Joe Elsey
@joeelsey
Nov 18 2014 01:13 UTC
I closed the db and did a new push on heroku
I opened the app. It works. I created the user based on the info you gave me. was given a jwt
Let me know if you get a confirmation code
Mark Harrell
@ecjs
Nov 18 2014 01:14 UTC
no code yet
Joe Elsey
@joeelsey
Nov 18 2014 01:14 UTC
Try using my number again to create a user.
Maybe its something on my end
Although our code should be identical
Mark Harrell
@ecjs
Nov 18 2014 01:15 UTC
I havent received my Twilio text yet..I just sent myself one
btw
you can look at your twilio logs
for sent text messages
Joe Elsey
@joeelsey
Nov 18 2014 01:18 UTC
where
you can also look at calls
btw duplicate anything is ok
been sending the same duplicate post
over and over
getting sms
Joe Elsey
@joeelsey
Nov 18 2014 01:20 UTC
hrm
no calls or sms in my twilio logs
even though I did receive some to my number
Mark Harrell
@ecjs
Nov 18 2014 01:21 UTC
hmm
maybe some process.env variables are wrong
do heroku config:get
Joe Elsey
@joeelsey
Nov 18 2014 01:21 UTC
my number is verified under caller ids
Mark Harrell
@ecjs
Nov 18 2014 01:21 UTC
or heroku config
Joe Elsey
@joeelsey
Nov 18 2014 01:21 UTC
ok
should I check my auth token"
?
Mark Harrell
@ecjs
Nov 18 2014 01:22 UTC
umm..your auth token shouldnt be there
o wiat
for twilio
check all of the variables
your phone number
all of it
TWILIO_ACCOUNT_SID: AC7277b2d36d056cb742981f4f239d3ba6
TWILIO_AUTH_TOKEN: a3e704ebb659af403eb8022324e98889
TWILIO_NUMBER: +16024836024
thats mine
running heroku config
Joe Elsey
@joeelsey
Nov 18 2014 01:23 UTC
should I use my twilio number?
I don't have my twilio number set in my cofig
set it
BOOSH
Confirm code
Mark Harrell
@ecjs
Nov 18 2014 01:27 UTC
there ya go
gotta have those variables set
Joe Elsey
@joeelsey
Nov 18 2014 01:28 UTC
I'm signing up my wife. I want to see if she gets the text :)
Mark Harrell
@ecjs
Nov 18 2014 01:28 UTC
lol
so the problem you were seeing
since there wasnt a twilio number set
it was res.sending that error
and then trying to res.send the json
web token
so I changed that file
going to update to dev now
Joe Elsey
@joeelsey
Nov 18 2014 01:30 UTC
Should I put that line inside of the client.sendmessage?
Mark Harrell
@ecjs
Nov 18 2014 01:30 UTC
no
Joe Elsey
@joeelsey
Nov 18 2014 01:30 UTC
ok
Mark Harrell
@ecjs
Nov 18 2014 01:30 UTC
I am making the changes now
pushing up
Mark Harrell
@ecjs
Nov 18 2014 01:36 UTC
so dev has been updated with that albeit minor change
but that should fix that error from bubbling up
Joe Elsey
@joeelsey
Nov 18 2014 01:40 UTC
fetched
Mark Harrell
@ecjs
Nov 18 2014 01:41 UTC
I am currently adding a route for resending user confirmation
if they didnt get it
Joe Elsey
@joeelsey
Nov 18 2014 01:41 UTC
Curretly working on the first user test
simple mocha doesn't really like the json format
holy shit. test 1 passed
Mark Harrell
@ecjs
Nov 18 2014 01:43 UTC
holy. shit.
what was test 1
Joe Elsey
@joeelsey
Nov 18 2014 01:44 UTC
create a user
how do I confirm a user again?
Mark Harrell
@ecjs
Nov 18 2014 01:44 UTC
you would have to use the sms code sent
Joe Elsey
@joeelsey
Nov 18 2014 01:44 UTC
I have that confirmation number
Mark Harrell
@ecjs
Nov 18 2014 01:45 UTC
you send that to /confirm using confirmationCode
Joe Elsey
@joeelsey
Nov 18 2014 01:45 UTC
Shit. That's almost impossible to test. Because I have to create the user to the get the sms....
Mark Harrell
@ecjs
Nov 18 2014 01:45 UTC
well
here is the thing
the confirmation code is stored in the user
Joe Elsey
@joeelsey
Nov 18 2014 01:45 UTC
i see it
Mark Harrell
@ecjs
Nov 18 2014 01:46 UTC
so user.confirmationCode
Joe Elsey
@joeelsey
Nov 18 2014 01:46 UTC
much easier now
so my create user test is creating a user, but with no name or anything... I supposed that is a plus. I'll work on it
Mark Harrell
@ecjs
Nov 18 2014 01:51 UTC
yah..odd..that sounds like a json prob
make sure to send it as json
dont just send it like you did other auth
Joe Elsey
@joeelsey
Nov 18 2014 01:53 UTC
yes. worked again
cool
moving along here
How would you get a user again? By the jwt token or the confirmation code?
Or by their username?
Mark Harrell
@ecjs
Nov 18 2014 01:55 UTC
jwt
Joe Elsey
@joeelsey
Nov 18 2014 01:55 UTC
ok. for the auth auth test I had to login
username and password
Annnd I can get a user now
Mark Harrell
@ecjs
Nov 18 2014 01:58 UTC
gj
Joe Elsey
@joeelsey
Nov 18 2014 01:59 UTC
cfbot image me randy savage snap
nooooo
doesn't work in here.
Mark Harrell
@ecjs
Nov 18 2014 01:59 UTC
lol!
Joe Elsey
@joeelsey
Nov 18 2014 02:07 UTC
I have 14 text messages from twilio
Mark Harrell
@ecjs
Nov 18 2014 02:08 UTC
LOL
why
oh man I miss randy savage
SNAP IT TO A SLIM JIM!
Joe Elsey
@joeelsey
Nov 18 2014 02:09 UTC
so your confirmation code post in confirm users
how would i enter that in post man?
Mark Harrell
@ecjs
Nov 18 2014 02:09 UTC
you can use url params
or {“confirmationCode”:”234234”}
created a route for reconfirming user
resending sms text
Joe Elsey
@joeelsey
Nov 18 2014 02:10 UTC
they way your post is setup is I enter an _id and confirmationCode
So that's what I'm testing for. User has _id and confirmationCode.
Mark Harrell
@ecjs
Nov 18 2014 02:11 UTC
umm, well thats how you get the confirmation code
it pulls the user id
from jwtauth
req.user._id
Joe Elsey
@joeelsey
Nov 18 2014 02:15 UTC
ok
Mark Harrell
@ecjs
Nov 18 2014 02:15 UTC
ok pushed another update to dev
this has the resendConfirmation route
Joe Elsey
@joeelsey
Nov 18 2014 02:18 UTC
would confirmed false be ok?
Since the user hasn't entered their confirmation code in yet?
probably not
Mark Harrell
@ecjs
Nov 18 2014 02:21 UTC
sure
thats not a big deal
the confirmed test isnt an issue
Joe Elsey
@joeelsey
Nov 18 2014 02:21 UTC
let me try some other stuff and I'll come back to it if I have to
I guess its false. I just created a new user and posted his jwt to the confirm. Came up false. I'm going to set the test as false for now.
I did this in postman
Joe Elsey
@joeelsey
Nov 18 2014 02:27 UTC
scratch that. changed the test to have property confirmed
passed
Currently there is no route for getting a confirmed user.
Mark Harrell
@ecjs
Nov 18 2014 02:30 UTC
what do you mean
Joe Elsey
@joeelsey
Nov 18 2014 02:31 UTC
nm
i'm wrong
one sec. moving fast here
Chareesa Graham
@Chareesa
Nov 18 2014 02:32 UTC
Can I add a password confirm to the User Schema?
Mark Harrell
@ecjs
Nov 18 2014 02:33 UTC
we can either do the password confirm there or in the frontend
I think it makes the most sense on the frontend (ie the iOS app or in the future the angular app)
saves us a database call
Joe Elsey
@joeelsey
Nov 18 2014 02:34 UTC
Not sure how to get a true message out of confirm user
Mark Harrell
@ecjs
Nov 18 2014 02:34 UTC
when you confirm the user
Joe Elsey
@joeelsey
Nov 18 2014 02:34 UTC
Tried using a jwt from a user created in the db, but all of them come up false
Mark Harrell
@ecjs
Nov 18 2014 02:34 UTC
when you create the user, it should return the user object
i mean when you confirm the user
the user object should have confirmed: true in it
Joe Elsey
@joeelsey
Nov 18 2014 02:35 UTC
The steps I've have taken so far is to create the user, then post the user's jwt into the cofirm route.
this gives a false
Chareesa Graham
@Chareesa
Nov 18 2014 02:40 UTC
For passwords.. we want them to include a number, an uppercase, and have a min length? Length of 6? Cause I got a regex for that.
Mark Harrell
@ecjs
Nov 18 2014 02:41 UTC
sure, works for me ;)
Joe Elsey
@joeelsey
Nov 18 2014 02:48 UTC
in confirm_user I feel like the user === null is bad
Mark Harrell
@ecjs
Nov 18 2014 02:49 UTC
basically that just says, if user.findOne doesnt find anything, then basically the confirmation failed
but we have to have something to catch that..because it doesnt spit out an error.
Joe Elsey
@joeelsey
Nov 18 2014 02:51 UTC
yeah. user.findOne isn't finding anything
at least when I enter the jwt token it doesn't.
trying to figure it out. last test for users at the moment.
Mark Harrell
@ecjs
Nov 18 2014 02:52 UTC
hmm..post the code for the test in here
```
Joe Elsey
@joeelsey
Nov 18 2014 02:52 UTC
it('should get a confirmed user', function(done){
    chai.request('https://quiet-dusk-4540.herokuapp.com')
      .post('/confirm')
      .set({jwt:jwtToken})
      .end(function(err,res){
        expect (err).to.be.eql(null);
        expect (res.body.confirmed).to.be.true;
      });
  });
Mark Harrell
@ecjs
Nov 18 2014 02:54 UTC
have you tried console logging the res.body
to see whats sitting in it
so here is the problem
Joe Elsey
@joeelsey
Nov 18 2014 02:55 UTC
I tried console logging the user param
Mark Harrell
@ecjs
Nov 18 2014 02:55 UTC
basically, you are just posting the jwttoken
to /confirm
/confirm is supposed to take the confirmationCode
Joe Elsey
@joeelsey
Nov 18 2014 02:56 UTC
so {confirmationCode: res.body.confirmationCode} ?
Mark Harrell
@ecjs
Nov 18 2014 02:56 UTC
right, but you wont get the confirmation code
right..
that comes from sms
Joe Elsey
@joeelsey
Nov 18 2014 02:57 UTC
yep
but it is set in the db
Mark Harrell
@ecjs
Nov 18 2014 02:57 UTC
so we need a way of retrieving that out of the db
Joe Elsey
@joeelsey
Nov 18 2014 02:58 UTC
wait
maybe I can set a var in my before
one sec
no
trying to figure out a way to grab the code from the db
Mark Harrell
@ecjs
Nov 18 2014 03:12 UTC
alright updated the /jobs route to allow a get request for all jobs for the users id
Joe Elsey
@joeelsey
Nov 18 2014 03:12 UTC
ok. Was going to see if there was a way to call the usersfindone in the chai test
Joe Elsey
@joeelsey
Nov 18 2014 03:21 UTC
ok and I can't fetch the upstream for some reason
wtf
Chareesa Graham
@Chareesa
Nov 18 2014 03:21 UTC
Right now, I'm working on fixing the app crash when it
's given a wrong input
Joe Elsey
@joeelsey
Nov 18 2014 03:21 UTC
i'm 3 commits behind
Chareesa Graham
@Chareesa
Nov 18 2014 03:22 UTC
weird...
Mark Harrell
@ecjs
Nov 18 2014 03:42 UTC
just pushed an update to dev
added the conciergeUnavailable route
Joe Elsey
@joeelsey
Nov 18 2014 03:47 UTC
I just noticed jscs was only checking server.js
I've got some work to do
Also, let me know if you can get a confirmed true message on your code confirmation
Currently the way the route is setup I don't think you can.
Mark Harrell
@ecjs
Nov 18 2014 03:49 UTC
we can setup a get request..
on the /confirm route
doing that now
Joe Elsey
@joeelsey
Nov 18 2014 04:00 UTC
jscs fixed
everything works still
Mark Harrell
@ecjs
Nov 18 2014 04:01 UTC
nice!
give me one second
Joe Elsey
@joeelsey
Nov 18 2014 04:01 UTC
you'll notice quite a few 'quotes' are missing from your jsons
Mark Harrell
@ecjs
Nov 18 2014 04:01 UTC
when you res.json
I dont think it matters
it parses it appropriately
is that what you were talking about?
for instance
res.status(200).json({confirmed: req.user.confirmed});
Joe Elsey
@joeelsey
Nov 18 2014 04:05 UTC
well
in confirm user its not returning the user. only the false message
I merged your commits
Mark Harrell
@ecjs
Nov 18 2014 04:05 UTC
ok
Joe Elsey
@joeelsey
Nov 18 2014 04:05 UTC
I'm caught up and now the app isi crashing
Mark Harrell
@ecjs
Nov 18 2014 04:05 UTC
actually just finished
you need to run it again
/confirmed route
thats where you can tell if the user is confirmed or not
Joe Elsey
@joeelsey
Nov 18 2014 04:06 UTC
your <<<<<<
is crashing the ap
Mark Harrell
@ecjs
Nov 18 2014 04:08 UTC
wait what
?
Joe Elsey
@joeelsey
Nov 18 2014 04:08 UTC
fixed
the <<<<<head was crashing the ap
I deleted them, reloaded and it works
Mark Harrell
@ecjs
Nov 18 2014 04:09 UTC
so that <<<< head is from merge conflicts.
that only comes in when you try and pull down a merge that conflicts with code that you have edited.
Joe Elsey
@joeelsey
Nov 18 2014 04:09 UTC
ah
first time for everything
well everything is passing jshint and jscs. First three user tests pass. I'm wondering if I should give up on the last user confirmation test for now and move onto confirming concierge
concierge users
Mark Harrell
@ecjs
Nov 18 2014 04:10 UTC
up to you..
Joe Elsey
@joeelsey
Nov 18 2014 04:11 UTC
I'm going to pass because tomorrow I'd like to see you post to user confirmations and get back a user instead of {confirmed:false}
can you show me your test
that you are trying to pass
paste code in here
Joe Elsey
@joeelsey
Nov 18 2014 04:13 UTC
it('should get a confirmed user', function(done){
    chai.request('https://quiet-dusk-4540.herokuapp.com')
      .post('/confirm')
      .send({jwt:jwtToken})
      .end(function(err,res){
        expect (err).to.be.eql(null);
        expect (res.body).to.be.true;
      });
  });
same as before
here's what its testing
app.post('/confirm', jwtauth, function(req, res) {
    var confirmation = req.body.confirmationCode;
    console.log(confirmation);
    User.findOne({_id: req.user._id, confirmationCode: confirmation}, function(err, user) {
      console.log(confirmation);
      if (user === null) {
        console.log(confirmation);
        return res.status(500).json({confirmed: false});
      }
      if (err) { return (err); }
      user.confirmed = true;
      user.save(function(err) {
        if (err) { return (err); }
        return res.status(202).json(user);
      });
    });
  });
I should enter in a jwt. The jwt should populate the _id and confirmationCode json
Mark Harrell
@ecjs
Nov 18 2014 04:14 UTC
ok..so there is a couple of issues here.
Joe Elsey
@joeelsey
Nov 18 2014 04:14 UTC
if both are present a user should be returned
Mark Harrell
@ecjs
Nov 18 2014 04:15 UTC
so the app.post..
what that route is doing
is taking in the request, that contains the users confirmation code from the SMS that we sent them when they first registered
confirmationCode = the users SMS code that we sent to them
so in order to confirm the user, you need to have the SMS code.
Joe Elsey
@joeelsey
Nov 18 2014 04:15 UTC
but the code is also present in the db
Mark Harrell
@ecjs
Nov 18 2014 04:16 UTC
but the code is not being provided
either in the response or the request
as far as the test is concerned..
there is no code
Joe Elsey
@joeelsey
Nov 18 2014 04:16 UTC
so always false?
Sorry if I'm not getting this
Mark Harrell
@ecjs
Nov 18 2014 04:17 UTC
well yes..when you make a post to /confirm, and you do not have the sms code..you are always going to get back..confirmed:false
because the user is not confirmed without their SMS code
Joe Elsey
@joeelsey
Nov 18 2014 04:17 UTC
ok
Mark Harrell
@ecjs
Nov 18 2014 04:17 UTC
if you have quite a bit of work done/tests passing
and you are all caught up with changes (i would do a fetch just in case to make sure you are)
send the push in
and I will look at your code
and we can brainstorm
Joe Elsey
@joeelsey
Nov 18 2014 04:21 UTC
lol. now I'm getting a timeout error
for that last teset
test
I'm caught up
with dev
weird timeout error on the last test.
fixed.
missing the done();
user tests all green
Mark Harrell
@ecjs
Nov 18 2014 04:26 UTC
nice
Joe Elsey
@joeelsey
Nov 18 2014 04:27 UTC
travis is being weird
says it can't find server.js, but I have no idea why its looking where its looking
Mark Harrell
@ecjs
Nov 18 2014 04:30 UTC
so in your user test
require('../../server');
it should only be
require('../server');
look back one folder instead of two
Joe Elsey
@joeelsey
Nov 18 2014 04:32 UTC
my simple mocha tasks don't run if I just have ../
Mark Harrell
@ecjs
Nov 18 2014 04:33 UTC
not sure what to tell you there..the ../server is what it should be
Joe Elsey
@joeelsey
Nov 18 2014 04:34 UTC
Running "simplemocha:src" (simplemocha) task
Warning: Cannot find module '../../server' Use --force to continue.
something is messed up
I got rid of the ../
I'm still seeing two concierges in travis as well
Mark Harrell
@ecjs
Nov 18 2014 04:35 UTC
well that shouldnt be the problem
Joe Elsey
@joeelsey
Nov 18 2014 04:36 UTC
Well the build passed. But only because simplemocha didn't run any tests with the ../
Mark Harrell
@ecjs
Nov 18 2014 04:36 UTC
hmm
can you give me the link to the travis test
I could run it for you tomorrow if you want?
Mark Harrell
@ecjs
Nov 18 2014 04:39 UTC
I think I know what the problem is
simplemocha: {
      options: {
        timeout: 3000,
        ignoreLeaks: false,
        reporter: 'tap'
      },
      src: ['test/**/user_test.js']
try using src test/user_test.js
without that **
Joe Elsey
@joeelsey
Nov 18 2014 04:42 UTC
None of my simple mocha tests are working now. About to flip the table
I even changed it back and nothing
fixed
man i'm going crazy
Mark Harrell
@ecjs
Nov 18 2014 04:43 UTC
:)
usually its something small
lets watch it update together
see what happens
Mark Harrell
@ecjs
Nov 18 2014 04:45 UTC
lol
Joe Elsey
@joeelsey
Nov 18 2014 04:46 UTC
i hate travis
Mark Harrell
@ecjs
Nov 18 2014 04:46 UTC
do me a favor
change ../../
process.env.MONGO_URL = 'mongodb://concierge:foobar123@ds053190.mongolab.com:53190/concierge';
var chai = require('chai');
var chaihttp = require('chai-http');
var User = require('../models/user_model.js');
chai.use(chaihttp);

require('../../server');
instead of that
this

process.env.MONGO_URL = 'mongodb://concierge:foobar123@ds053190.mongolab.com:53190/concierge';
var chai = require('chai');
var chaihttp = require('chai-http');
var User = require('../models/user_model.js');
chai.use(chaihttp);

require('../server');
you have an extra ../
that test file is looking back past where server is
Joe Elsey
@joeelsey
Nov 18 2014 04:48 UTC
when I change that simple mocha doesnt run any tests
it just says passes and done
Mark Harrell
@ecjs
Nov 18 2014 04:51 UTC
well thats the correct syntax there
so fix that
and then we can move from there
Joe Elsey
@joeelsey
Nov 18 2014 04:53 UTC
Ok
I'm about to have a meltdown. I was probably testing a server.js file above the concierge file
what I don't understand is I was getting values back from everything
I can find the server with in the concierge file and I'm running tests with no errors.
It doesn't make any sense
Mark Harrell
@ecjs
Nov 18 2014 04:57 UTC
so if u could..go ahead and push up to dev..
have you fetched the most recent additions
to dev
Joe Elsey
@joeelsey
Nov 18 2014 04:59 UTC
yes
I tried running mocha directly from my users test
Mark Harrell
@ecjs
Nov 18 2014 04:59 UTC
what happened
Joe Elsey
@joeelsey
Nov 18 2014 04:59 UTC
apparently my twilio number is set wrong because I have the + in front of my number
changing it now
RestClient requires an Account SID and Auth Token set explicitly or via the TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN environment variables
Ever seen this?
Mine are set
Mark Harrell
@ecjs
Nov 18 2014 05:02 UTC
so basically
you cant run anything locally
so if you are trying to run the tests locally
I need to look at your code..
one sec
right so basically, you are running it locally
its not going to work
you are including the ../server file
Joe Elsey
@joeelsey
Nov 18 2014 05:04 UTC
so get rid of it?
Mark Harrell
@ecjs
Nov 18 2014 05:04 UTC
no
dont try and run it locally
also, for travis..
you are going to need to set the process.env variables
at the very top of the test file
similar to how you did with the Mongo url
so set all of your variables (although it won’t really use any of them)
Joe Elsey
@joeelsey
Nov 18 2014 05:05 UTC
ok
I think I fixed it
Mark Harrell
@ecjs
Nov 18 2014 05:05 UTC
you just cant test locally,
because of twilio
Joe Elsey
@joeelsey
Nov 18 2014 05:06 UTC
I commented out the require server and it ran the tests
Mark Harrell
@ecjs
Nov 18 2014 05:06 UTC
yah, thats not a bad idea
Joe Elsey
@joeelsey
Nov 18 2014 05:06 UTC
let me repush.
Mark Harrell
@ecjs
Nov 18 2014 05:06 UTC
we really dont need the server
Joe Elsey
@joeelsey
Nov 18 2014 05:06 UTC
maybe this evening wasn't a waste of time after all
Mark Harrell
@ecjs
Nov 18 2014 05:06 UTC
because all the tests are happening remotely
thats why the tests were successfuly
running before
does that make sense though? with twilio? and why we cant run tests locally
Joe Elsey
@joeelsey
Nov 18 2014 05:08 UTC
yes
I didn't think I was running the tests locally, but I was
I didn't realize because i was getting texts and the db was updating
build passed. tests ran
Mark Harrell
@ecjs
Nov 18 2014 05:09 UTC
well done
Joe Elsey
@joeelsey
Nov 18 2014 05:09 UTC
you want me to create a pull request.
Mark Harrell
@ecjs
Nov 18 2014 05:09 UTC
yup
Joe Elsey
@joeelsey
Nov 18 2014 05:09 UTC
I think I should book out of here
Mark Harrell
@ecjs
Nov 18 2014 05:09 UTC
no prob
I will merge it if all looks good
and take a closer look at tests
Joe Elsey
@joeelsey
Nov 18 2014 05:10 UTC
please do
second pair of eyes would be nice
Mark Harrell
@ecjs
Nov 18 2014 05:11 UTC
so question
I was told that ‘_id'
was required
like it wont work
Jobs.remove({_id: job._id}, function(err) {
Joe Elsey
@joeelsey
Nov 18 2014 05:12 UTC
hrm
jscs didn't like it
Mark Harrell
@ecjs
Nov 18 2014 05:12 UTC
right
tyler told us to ignore that
in class
Joe Elsey
@joeelsey
Nov 18 2014 05:12 UTC
then I'll have to make an exception for jscs and add those quotes back in
Mark Harrell
@ecjs
Nov 18 2014 05:12 UTC
ya
I would do that before we merge this
so close that pull request
let me research that
Joe Elsey
@joeelsey
Nov 18 2014 05:13 UTC
done
I'm going to look for the exception before I leave
Mark Harrell
@ecjs
Nov 18 2014 05:13 UTC
we might want to look into this a bit more
I havent really tried it without the quotes
I just remember them saying that
Joe Elsey
@joeelsey
Nov 18 2014 05:14 UTC
Well. Even though the tests pass I didn't receive any texts
may be an issue
let me try creating a user
I was just able to create a user and got a text
so current build works without quotes on my end, but I won't do another pull request until tomorrow morning
Mark Harrell
@ecjs
Nov 18 2014 05:16 UTC
ok
let me look into it
I am going to make a simple change, and push it to heroku
to test if removing those quotes is a problem or not
Mark Harrell
@ecjs
Nov 18 2014 05:21 UTC
ok joe
it works
sooooo
tyler was wrong
Joe Elsey
@joeelsey
Nov 18 2014 05:22 UTC
pull request?
Mark Harrell
@ecjs
Nov 18 2014 05:22 UTC
yup
do it
with those silly ole ‘ gone
dont need em
worked just fine without
Joe Elsey
@joeelsey
Nov 18 2014 05:24 UTC
the only weird thing is the test passes, but doesn't send me a text. When I create a user normally I get a text. Maybe its supposed to work that way?
Mark Harrell
@ecjs
Nov 18 2014 05:24 UTC
hmm
I will test
on my end
see if it works
Joe Elsey
@joeelsey
Nov 18 2014 05:24 UTC
it will work
if you create a user you get the jwt and the confirmation text
if you run the test the test will pass because it gets a jwt for user create, but no text
which isn't a terrible thing because I deleted about sixty texts from my phone.
Mark Harrell
@ecjs
Nov 18 2014 05:25 UTC
LOL
omg
awesome
ok
merged it
going to pull down to my local now
Joe Elsey
@joeelsey
Nov 18 2014 05:26 UTC
test it before I leave
Mark Harrell
@ecjs
Nov 18 2014 05:27 UTC
ok
really quick..
Joe Elsey
@joeelsey
Nov 18 2014 05:28 UTC
i'm here
Mark Harrell
@ecjs
Nov 18 2014 05:28 UTC
putting your mongo url in git is not a good idea
usually what you want to do..is install mongo as a local service in travis
i dont even think its running any database calls here though
Joe Elsey
@joeelsey
Nov 18 2014 05:29 UTC
ok. so set that as an env?
Mark Harrell
@ecjs
Nov 18 2014 05:29 UTC
I dont think we make any db calls in here
Joe Elsey
@joeelsey
Nov 18 2014 05:29 UTC
get rid of it?
Thought I needed it for tests...
Mark Harrell
@ecjs
Nov 18 2014 05:29 UTC
hmm maybe, maybe not
I will work on it a little bit
you head out
if we dont need it I will remove it
Joe Elsey
@joeelsey
Nov 18 2014 05:30 UTC
Cool
Sorry for the drama. But I strongley believe this is a working test of the user routes
Mark Harrell
@ecjs
Nov 18 2014 05:30 UTC
no drama…this is just how it goes
you have given us a good start for tests..
Joe Elsey
@joeelsey
Nov 18 2014 05:30 UTC
Aweomse
Positive mental attitude
Mark Harrell
@ecjs
Nov 18 2014 05:31 UTC
yah ;)
Joe Elsey
@joeelsey
Nov 18 2014 05:31 UTC
Ok. Heading out
:)
Mark Harrell
@ecjs
Nov 18 2014 05:31 UTC
later!
thanks!
Joe Elsey
@joeelsey
Nov 18 2014 05:31 UTC
Thank you
Chareesa Graham
@Chareesa
Nov 18 2014 05:38 UTC
Yay!! I got password requirements and I got it checking to see if the user name already exists..
took longer than I thought cause I ran into so many errors!
like it CRASHING every wrong turn
Mark Harrell
@ecjs
Nov 18 2014 06:04 UTC
lol
good job!@
did you merge the updated dev
from upstream
before doing this pull request
went ahead and merged
there are a few code style errors
I will take care of those ;)
Mark Harrell
@ecjs
Nov 18 2014 06:11 UTC
all fixed, tests passing now
Chareesa Graham
@Chareesa
Nov 18 2014 15:59 UTC
Oops, sorry. Just read this. I merged, yes.
Joe Elsey
@joeelsey
Nov 18 2014 17:02 UTC
I just merged the current repo. I ran a quick grunt test this morning and noticed the changed url. I'm going to keep the user test that url for today since it works.
Chareesa Graham
@Chareesa
Nov 18 2014 20:49 UTC
For the bash profile:
export TWILIO_ACCOUNT_SID=
export TWILIO_AUTH_TOKEN=
export TWILIO_NUMBER=+
.bash_profile
open ~/.bash_profile