File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-param-reassign */
2
2
3
- import request from 'request'
4
- import cheerio from 'cheerio'
5
- import app from '../../server'
3
+ const request = require ( 'request' )
4
+ const cheerio = require ( 'cheerio' )
5
+ const app = require ( '../../server' )
6
6
7
7
app . get ( '/tracking/:trackingNumber' , ( req , res ) => {
8
8
const url = 'http://www.postur.is/' +
Original file line number Diff line number Diff line change 1
- import request from 'request'
2
- import assert from 'assert'
1
+ const request = require ( 'request' )
2
+ const assert = require ( 'assert' )
3
+ const nock = require ( 'nock' )
4
+
5
+ describe . only ( 'tracking' , ( ) => {
6
+ const trackingNumber = 'TRACKING_NUMBER'
7
+ before ( ( ) => {
8
+ const path = '/einstaklingar/senda-pakka-innanlands/finna-sendingu/' +
9
+ `?TrackingNumber=${ trackingNumber } &Language=IS`
10
+ const scope = nock ( 'http://www.postur.is' )
11
+ . get ( path )
12
+ . reply ( 200 , 'domain matched' )
13
+ //const secondScope = nock('http://localhost:3101')
14
+ // .get(`/tracking/${trackingNumber}`)
15
+ // .reply(200, 'domain matched')
16
+ } )
3
17
4
- describe ( 'tracking' , ( ) => {
5
18
it ( 'should return a 404 when the tracking number can\'t be found' , ( done ) => {
6
- request . get ( 'http://localhost:3101/tracking/derp' , ( error , response ) => {
19
+ request . get ( `http://localhost:3101/tracking/${ trackingNumber } ` , ( error , response ) => {
20
+ console . log ( error )
21
+ console . log ( response )
7
22
assert . equal ( 404 , response . statusCode )
8
23
9
24
done ( )
You can’t perform that action at this time.
0 commit comments