您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

system.spec.js 1015B

12345678910111213141516171819202122232425
  1. import { expect, test } from 'vitest'
  2. import { System } from '../src/system.js'
  3. test('system - instantiates and stores inventory correctly', () => {
  4. let testSystem = new System()
  5. testSystem.add('aaa', ['input_test', 'output_test', { id: 'aaa' }])
  6. expect(testSystem.inputs).toStrictEqual(['input_test'])
  7. expect(testSystem.outputs).toStrictEqual(['output_test'])
  8. expect(testSystem.containers[0].id).toStrictEqual('aaa')
  9. // Make sure inputs and outputs get reassigned
  10. testSystem.replaceContainer({ id: 'aaa' })
  11. expect(testSystem.inputs).toStrictEqual(['input_test'])
  12. expect(testSystem.outputs).toStrictEqual(['output_test'])
  13. expect(testSystem.containers[0].id).toStrictEqual('aaa')
  14. const inputs = testSystem.inputsFor({ id: 'aaa' })
  15. expect(inputs).toStrictEqual('input_test')
  16. const outputs = testSystem.outputsFor({ id: 'aaa' })
  17. expect(outputs).toStrictEqual('output_test')
  18. testSystem.remove('aaa')
  19. expect(testSystem.inventory).toStrictEqual({})
  20. })