Writing your first model

Exercise: Adding a product before login

Open your terminal and navigate to a directory where you have write permissions. Execute the following command and respond to the prompts:

$ provengo create first-model

Executing the command will generate a directory named first-model, which contains a hello_world.js file located in the spec/js subdirectory. Clear the existing content of this file and replace it with the following code. If desired, you can also rename the file:

bthread("", function () {
    sync({ request: Event('Login', { email: 'bob.marley@provego.com', password: 'ishotthesherif' }) });
    sync({ request: Event('AddProductToCart', { name: 'HUMMINGBIRD PRINTED T-SHIRT' }) });
    sync({ request: Event('AddProductToCart', { name: 'HUMMINGBIRD PRINTED SWEATER' }) });
    sync({ request: Event('Checkuout', { defaultAdress: true, defaultPaymentMethod: true }) });
})

Your task is to add an event to add a T-SHIRT before login. Once you incorporate your code, executing the command:

$ provengo analyze --style full -f pdf first-model

should generate the file first-model/products/run-source/testSpace.pdf. If you added your code correctly, this file should look similar to:

Expected Test Space

If you get a different result, try to figure out what went wrong. If you get stuck, you can find the solution in the first-model/solution directory.