1 | 'use strict'; |
||
2 | |||
3 | var chai = require('chai'), |
||
4 | expect = require('chai').expect, |
||
5 | app = require('../app').app, |
||
6 | chaiHttp = require('chai-http'), |
||
7 | server = require('../app'), |
||
8 | should = chai.should(), |
||
9 | request = require('supertest').agent(app.listen()), |
||
10 | supertest = require('supertest'), |
||
11 | sinon = require('sinon'), |
||
12 | ejs = require('ejs'), |
||
13 | handlebars = require('handlebars'), |
||
14 | superagent = require('superagent'); |
||
15 | |||
16 | |||
17 | |||
18 | describe('/GET Home Page', function() { |
||
19 | |||
20 | it('it should render the home page', function() { |
||
21 | |||
22 | var fields, html; |
||
23 | |||
24 | beforeEach(function() { |
||
25 | this.fields = { first: "123" }; |
||
26 | this.html = "{{#ifequal first last}}true{{else}}false{{/ifequal}}"; |
||
27 | }); |
||
28 | |||
29 | it('will return false when the values are not equal', function() { |
||
30 | var template = Handlebars.compile(this.html); |
||
0 ignored issues
–
show
|
|||
31 | this.fields['last'] = 123; |
||
32 | var result = template(this.fields); |
||
33 | expect(result).toEqual("false"); |
||
34 | }); |
||
35 | |||
36 | it('will return true when the values are equal', function() { |
||
37 | var template = Handlebars.compile(this.html) |
||
0 ignored issues
–
show
The variable
Handlebars seems to be never declared. If this is a global, consider adding a /** global: Handlebars */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
38 | this.fields['last'] = "123"; |
||
39 | var result = template(this.fields) |
||
40 | expect(result).toEqual("true"); |
||
41 | }); |
||
42 | |||
43 | }); |
||
44 | |||
45 | }); |
||
46 | |||
47 | |||
48 | |||
49 | describe('homepage', function(){ |
||
50 | it('should respond to GET',function(){ |
||
51 | superagent |
||
52 | .get('http://localhost:'+app.port) |
||
53 | .end(function(res){ |
||
54 | expect(res.status).to.equal(200); |
||
55 | done() |
||
56 | }) |
||
57 | }); |
||
58 | }); |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.