-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(world): add tests for getFade and getSizeCategory
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { getSizeCategory, getFade } from '../lib/world.js'; | ||
import { describe, expect, test } from 'vitest'; | ||
|
||
describe('world', () => { | ||
describe('getFade', () => { | ||
test('should return expected fade for distance of 1000.0 and size category of 0', () => { | ||
expect(getFade(1000.0, 0)).toBe(0.0); | ||
}); | ||
|
||
test('should return expected fade for distance of 1.0 and size category of 4', () => { | ||
expect(getFade(1.0, 4)).toBe(1.0); | ||
}); | ||
|
||
test('should return expected fade for distance of 145.0 and size category of 1', () => { | ||
expect(getFade(145.0, 1)).toBe(0.5); | ||
}); | ||
|
||
test('should return expected fade for distance of 149.999 and size category of 1', () => { | ||
expect(getFade(149.999, 1)).toBe(0.0); | ||
}); | ||
|
||
test('should return expected fade for distance of 140.001 and size category of 1', () => { | ||
expect(getFade(140.001, 1)).toBe(1.0); | ||
}); | ||
}); | ||
|
||
describe('getSizeCategory', () => { | ||
test('should return expected category for size of 0.1', () => { | ||
expect(getSizeCategory(0.1)).toBe(0); | ||
}); | ||
|
||
test('should return expected category for size of 4.0', () => { | ||
expect(getSizeCategory(4.0)).toBe(1); | ||
}); | ||
}); | ||
}); |