[go: up one dir, main page]

Skip to content

Commit

Permalink
Fixed year/decade and wrote test for checking in future
Browse files Browse the repository at this point in the history
  • Loading branch information
ericman314 committed Apr 15, 2018
1 parent 9210cc9 commit 2fcec34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/type/unit/Unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ function factory (type, config, load, typed, math) {
offset: 0
},
decade: {
name: 'year',
name: 'decade',
base: BASE_UNITS.TIME,
prefixes: PREFIXES.NONE,
value: 315576000, //Julian decade
Expand Down Expand Up @@ -2480,7 +2480,7 @@ function factory (type, config, load, typed, math) {
offset: 0
},
watt: {
name: 'W',
name: 'watt',
base: BASE_UNITS.POWER,
prefixes: PREFIXES.LONG,
value: 1,
Expand Down Expand Up @@ -2791,6 +2791,7 @@ function factory (type, config, load, typed, math) {
weeks: 'week',
months: 'month',
years: 'year',
decades: 'decade',

hertz: 'hertz',

Expand Down
6 changes: 6 additions & 0 deletions test/type/unit/Unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,12 @@ describe('Unit', function() {
assert.equal(new Unit(1, 'ohm^-1').equals(new Unit(1, 'S')) , true);
assert.equal(new Unit(1, 'eV') .equals(new Unit(1.602176565e-19, 'J')), true);
});

it("For each built-in unit, 'name' should match key", function() {
for(var key in Unit.UNITS) {
assert.equal(key, Unit.UNITS[key].name);
}
});
});

describe('createUnitSingle', function() {
Expand Down

0 comments on commit 2fcec34

Please sign in to comment.