You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617
  1. import { expect, test } from 'vitest'
  2. import { Container } from '../src/container.js'
  3. import { fill, drain } from '../src/utils.js'
  4. const dims = { l: 10, w: 10, h: 10 } // inches
  5. const capacity = 4.329004329004329 // gallons
  6. test('utils - fill and drain work correctly', () => {
  7. let testContainer = new Container(dims)
  8. testContainer = fill({ container: testContainer, amount: capacity })
  9. expect(testContainer.liquidVolumeFilled).toBe(capacity)
  10. expect(testContainer.liquidVolumeRemaining).toBe(0)
  11. testContainer = drain({ container: testContainer, amount: capacity })
  12. expect(testContainer.liquidVolumeFilled).toBe(0)
  13. expect(testContainer.liquidVolumeRemaining).toBe(capacity)
  14. })