These are chat archives for CodeHubOrg/discussions

23rd
Nov 2016
Katja Durrani
@katjad
Nov 23 2016 02:35
@rinse0ut Just what about our app? Would you work on that too? But that's probably a bit much. I'll try to focus on the app, and see what I can do with it.
Dave Thomson
@rinse0ut
Nov 23 2016 07:26
I ws
Yes im keen to get a basic mobile Page index and text pages working with react ionic
Dave Thomson
@rinse0ut
Nov 23 2016 09:40
@katjad Please could you post the issue you had last night and the solution to the github repo?
Tim Handy
@TimHandy
Nov 23 2016 12:33
Katja Durrani
@katjad
Nov 23 2016 13:01
@rinse0ut Okay, going to do that tonight
Dave Thomson
@rinse0ut
Nov 23 2016 13:03
:sunglasses: :+1: :+1:
Katja Durrani
@katjad
Nov 23 2016 13:03
@TimHandy Think you need to leave credit cards there :/ Trying to avoid that - is that offer so you can have private repos or other benefits than that?
Tim Handy
@TimHandy
Nov 23 2016 13:03
nope
I just clicked on it, ti went to the github page and then clicked redeem
no credit card in sight!
Coupon
You have an active coupon for $7.00 off for 2 years, until 2018-11-23 (almost 2 years from now).
Payment
No payment method on file.
Plan
Personal – Unlimited private repositories
Looks like this is the only downside... but you could always move your repos before the end of the two years if you do create any private ones...
Downgrade to free
Downgrade
You can downgrade at anytime, but you will no longer be able to access your private repositories or create new ones.
I guess this is in reponse to gitlab's free private repos
who knows... in two years maybe they'll all be free!
Katja Durrani
@katjad
Nov 23 2016 13:08
Oh I see that's good then. Maybe it's because I tried for Codehub - but also was from phone and very quick. I'll do it for my own anyway, thanks for the link!
Dave Thomson
@rinse0ut
Nov 23 2016 13:10
Bitbucket is free and private alternative.
Great to have a private github one though, nice one.
Tim Handy
@TimHandy
Nov 23 2016 13:58
yeah, I've got a gitlab with free private repos also...not using it though...nothing yet worthy of being private in any of mine as I don't have sneaky stuff or client data to hold yet... but someday maybe.
Dave Thomson
@rinse0ut
Nov 23 2016 14:03
Cool, we used to have an internally hosted gitlab at an old work place. Another firm I work for use my bitbucket account for their repos!
*worked
Tim Handy
@TimHandy
Nov 23 2016 15:42
haha, nice... sounds like you have them over a barrel!
so... quick question to anyone, regarding mocha... do all the functions I want to test have to be exported? i.e. module.exports and all that? What if I just want to test a function in a file that's not exported (like what if its an app where all functions are in a single app.js file for example).
Dave Thomson
@rinse0ut
Nov 23 2016 15:48
Yes, that's the only way you can access them as far as I know. If your had an app object literal with the functions assigned to that then you could just export the app object
Tim Handy
@TimHandy
Nov 23 2016 15:49
working kind of like a wrapper?
Dave Thomson
@rinse0ut
Nov 23 2016 15:50
more of an object orientated approach, I’’l make an example…
Tim Handy
@TimHandy
Nov 23 2016 15:50
I think i understand what you mean, so a controller object, model object etc
It behaves like an object where this is confinded to it’s self
@marckimbrey This is what I was talking about last session regarding your dungeon map code.
So now you can export the app and import it into your tests and have access to all of it’s methods.
Dave Thomson
@rinse0ut
Nov 23 2016 16:13
I’ve used this approach at work and it’s a great way to organise your code imo.
Tim Handy
@TimHandy
Nov 23 2016 16:30
Like it... yep...kinda with you there... so you would do an exports.app = {.....} on line 3 to have app available to import to a test?
and then in the test file, let app = require('./app.js')
Dave Thomson
@rinse0ut
Nov 23 2016 16:33
Yes or at the end of the file
import expect from 'expect'
import app from '../app'

describe('App test', () => {
  it('should do something', () => {
      const expected = true
      app.init({someSetting: false})
      const actual = app.doSomething();
      expect(expected).toEqual(actual)
  })
});
Tim Handy
@TimHandy
Nov 23 2016 16:34
ok... and finally... i shouldn't need phantomjs or any other shenanigans? I'm getting an error that $ and 'document' aren't available that seem to point to a lot of docs about phantomjs headless servers.
Dave Thomson
@rinse0ut
Nov 23 2016 16:35
How cool is the mark down btw!
Tim Handy
@TimHandy
Nov 23 2016 16:35
yeah, it's very good
got rid of the jquery by requiring jquery and npm installing jquery
Dave Thomson
@rinse0ut
Nov 23 2016 16:36
Yes there’s no global window or document object from the browser so you need jsdom or something.
Tim Handy
@TimHandy
Nov 23 2016 16:36
ahh... another piece of the puzzle.. ok I'll go take a look at that now.
Dave Thomson
@rinse0ut
Nov 23 2016 16:36
Eg...
Tim Handy
@TimHandy
Nov 23 2016 16:36
Cheers Dave
np
You can see it creates global window and document vars
Tim Handy
@TimHandy
Nov 23 2016 16:38
ok, yes... I'll have a play with it now. Thanks. What's the { jsdom } import syntax... not seen that
why the curlies?
does that mean import everything?
Dave Thomson
@rinse0ut
Nov 23 2016 16:39
It’s to do with whether you export the function by name or by default
Tim Handy
@TimHandy
Nov 23 2016 16:39
oh, ok, so I assume that's the default version
cool, learning a lot today!
Dave Thomson
@rinse0ut
Nov 23 2016 16:40
yes, if it’s by name no curlies or you get an error which probably won’t help you (unless it takes you to stack overflow)
Tim Handy
@TimHandy
Nov 23 2016 16:41
yes, used it by name but done an export default, only read about it.
Dave Thomson
@rinse0ut
Nov 23 2016 16:43
try both and see if you can make it error