| 1234567891011121314151617 |
- import { expect, test } from 'vitest'
- import { Container } from '../src/container.js'
- import { fill, drain } from '../src/utils.js'
-
- const dims = { l: 10, w: 10, h: 10 } // inches
- const capacity = 4.329004329004329 // gallons
-
- test('utils - fill and drain work correctly', () => {
- let testContainer = new Container(dims)
- testContainer = fill({ container: testContainer, amount: capacity })
- expect(testContainer.liquidVolumeFilled).toBe(capacity)
- expect(testContainer.liquidVolumeRemaining).toBe(0)
-
- testContainer = drain({ container: testContainer, amount: capacity })
- expect(testContainer.liquidVolumeFilled).toBe(0)
- expect(testContainer.liquidVolumeRemaining).toBe(capacity)
- })
|