Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jhermsmeier committed Jan 8, 2014
1 parent e186091 commit 387f317
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/parse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var assert = require( 'assert' )
var TLE = require( '../' )

describe( 'TLE.parse', function() {

it( 'should not throw', function() {

var set = 'ISS (ZARYA)\n' +
'1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927\n' +
'2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537'

var tle = TLE.parse( set )

})

})
28 changes: 28 additions & 0 deletions test/parseDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,32 @@ var TLE = require( '../' )

describe( 'TLE.parseDate', function() {

it( 'should work', function() {
var date = TLE.parseDate( '06040.85138889' )
})

it( 'Hell, I do hate writing tests', function() {
var date = TLE.parseDate( '14006.78411147' )
assert.equal( date.getFullYear(), 2014 )
assert.equal( date.getDay(), 2 )
})

it( 'should ignore whitespace between epoch and days', function() {
var date = TLE.parseDate( '14 006.78411147' )
assert.equal( date.getFullYear(), 2014 )
assert.equal( date.getDay(), 2 )
})

it( 'should drop to last century', function() {
var date = TLE.parseDate( '86 046.78411147' )
assert.equal( date.getFullYear(), 1986 )
})

it( 'should go back to the future', function() {
var year = new Date().getFullYear()
var epoch = year % 100 + 1
var date = TLE.parseDate( epoch + '046.78411147' )
assert.equal( date.getFullYear(), year + 1 )
})

})

0 comments on commit 387f317

Please sign in to comment.