import { expect } from 'chai'
import particle from './particle'
import { update } from './particle'

describe('Particle Functionality', () => {

    it('should have default values', () => {
        const p = particle()
        expect(p).to.be.ok
        expect(p.missingAttribute).to.not.be.ok
        // check position, velocity, acceleration, mass
    })

    it('should update the position by the velocity', () => {
        const p = particle({ position: [1, 1], velocity: [0.5, -0.5] })
        const { position } = update(p, 1.0)
        expect(position).to.equal([1.5, 0.5])
    })

    it('should update the position by the velocity and time delta', () => {
        const p = particle({ position: [1, 1], velocity: [0.5, -0.5] })
        const { position } = update(p, 2.0) // dt is different here
        expect(position).to.equal([2.0, 0.0])
    })

    it('should update the velocity by the acceleration', () => {
        // similar to the previous check
        expect(1).to.equal(1)
    })

    it('particles should wrap around the world', () => {
        // create a particle with position outside
        // of the canvas area.  update() should
        // bring the particle back inside
        // check all four sides
        expect(1).to.equal(1)
    })

})

@@ -343,23 +343,167 @@
 n, mass%0A
+        expect(p.position).to.be.ok%0A        expect(p.velocity).to.be.ok%0A        expect(p.acceleration).to.be.ok%0A        expect(p.mass).to.be.ok%0A
     %7D)%0A
-
 %0A    it(
@@ -1101,32 +1101,35 @@
 us check%0A       
+ //
  expect(1).to.eq
@@ -1127,32 +1127,199 @@
 (1).to.equal(1)%0A
+        const p = particle(%7B velocity: %5B1, 1%5D, acceleration: %5B0.5, -0.5%5D %7D)%0A        const %7B velocity %7D = update(p, 1.0)%0A        expect(velocity).to.equal(%5B1.5, 0.5%5D) %0A
     %7D)%0A%0A    it('
@@ -1539,32 +1539,35 @@
 ur sides%0A       
+ //
  expect(1).to.eq
@@ -1569,23 +1569,462 @@
 to.equal(1)%0A
+        // update(p, 3.521, %7B width:111, height: 222 %7D)%0A        var width = 800%0A        var height = 800%0A        const p = particle(%7B position: %5B900, 865%5D, velocity: %5B0.5, -0.5%5D %7D)%0A        const %7B position %7D = update(p, 1)%0A        console.log(position)%0A        expect(position%5B0%5D %3C= width).to.be.true%0A        expect(position%5B0%5D %3E= 0).to.be.true%0A        expect(position%5B1%5D %3C= height).to.be.true%0A        expect(position%5B1%5D %3E= 0).to.be.true%0A%0A
     %7D)%0A%0A%7D)%0A

write the tests using chai