Skip to content

app.update is not a function #72

Open
@gracezhouu

Description

@gracezhouu

Hi Guys
When I go to the second step, and basic update function and run the test,

/**
 * `update` transforms the `model` based on the `action`.
 * @param {String} action - the desired action to perform on the model.
 * @param {Object} model - the App's (current) model (or "state").
 * @return {Object} new_model - the transformed model.
 */
function update(action, model) {
 switch (action) {                  // action (String) determines which case
   default:                         // if action unrecognised or undefined,
     return model;                  // return model unmodified
 }    // default? https://softwareengineering.stackexchange.com/a/201786/211301
}

it supposed to pass the test, but there is the following error message, anyone know why?

TAP version 13

model (Object) has desired keys

ok 1 todos and hash keys are present.
ok 2 model.todos is an Array

update default case should return model unmodified

/Users/rushlin/Downloads/mystuff/javascript-todo-list/test/todo-app1.test.js:19
const unmodified_model = app.update('UNKNOWN_ACTION', model);
^

TypeError: app.update is not a function
at Test. (/Users/rushlin/Downloads/mystuff/javascript-todo-list/test/todo-app1.test.js:19:32)
at Test.bound [as _cb] (/Users/rushlin/node_modules/tape/lib/test.js:84:32)
at Test.run (/Users/rushlin/node_modules/tape/lib/test.js:101:31)
at Test.bound [as run] (/Users/rushlin/node_modules/tape/lib/test.js:84:32)
at Immediate.next (/Users/rushlin/node_modules/tape/lib/results.js:83:19)
at processImmediate (internal/timers.js:456:21)
shanshandeMacBook-Pro:javascript-todo-list rushlin$

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions