Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check JS Foundations for impure functions #681

Open
wvmitchell opened this issue Apr 20, 2023 · 3 comments
Open

Check JS Foundations for impure functions #681

wvmitchell opened this issue Apr 20, 2023 · 3 comments
Assignees
Labels
Activity An issue affecting homework or other activity M1 M1 task

Comments

@wvmitchell
Copy link
Collaborator

wvmitchell commented Apr 20, 2023

Description

In seeing students solve the current (new) JS foundations, some of the tests cannot be passed without creating an impure function. None of the tests should require this.

Summary of Changes

  • Solve all the existing JS foundations, looking for spaces where the test cannot be solved without creating an impure function
  • Refactor/replace any tests that require the creation of an impure function

Notes

  • Testing for the side effect of a function is an example of this. If you encounter a test where it is expected that something has changed as the result of running a function, but that function didn't return anything, it's a side effect, and needs to go away.
  • This issue will require changes to the JS Foundations repo, even tho the issue is linked to front-end-curriculum. Please make sure to make your PR there, and link the PR in a comment below.
@wvmitchell wvmitchell added M1 M1 task Activity An issue affecting homework or other activity labels Apr 20, 2023
@kaylagordon
Copy link
Collaborator

An example is in spa tests:

 it.skip('should rack up a bill', function(){
    var nik = createCustomer('Nik', 0 , [])
    var footMassage = createService('foot massage', 65)
    var facial = createService('facial', 50)
    var nikFootMassage = bookServices(nik, footMassage)
    var nikFacial = bookServices(nik, facial)
    
    assert.deepEqual(nikFootMassage.bookings, ['foot massage','facial'])
    assert.deepEqual(nikFacial.bill, 115)
  })

Where you'd have to push the service into nik when bookServices is invoked in order for nikFootMassage and nikFacial to be connected.

@sertmer sertmer self-assigned this Apr 20, 2023
@sertmer
Copy link
Collaborator

sertmer commented Apr 20, 2023

Notes for me:
I'm also going to be keeping an eye on on wether or not to put them in any order.
Might also fix some things like mis-named tests, confusing themes (vhs), file names

@sertmer
Copy link
Collaborator

sertmer commented May 11, 2023

Here's the PR for these changes :)

turingschool-examples/javascript-foundations#115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Activity An issue affecting homework or other activity M1 M1 task
Projects
None yet
Development

No branches or pull requests

3 participants