Giter VIP home page Giter VIP logo

codeacademy-tdd-vidbits's Introduction

Hi there ๐Ÿ‘‹

Top Langs

Views:

kaoskeya's GitHub stats

[GitHub Streak

codeacademy-tdd-vidbits's People

Contributors

kaoskeya avatar

Watchers

 avatar  avatar

codeacademy-tdd-vidbits's Issues

Overall

200 Ok Pass!

Congratulations! you did a great job, met expectations, and had nice and helpful comments throughout (always greatly appreciated and helpful).
If you want to build upon it, try checking where would you able to minimize repetition by creating variables with values and functions that you can implement in different places.

Best of luck and I hope you've been enjoying the course!

Tests

Great build! Awesome work on your feature tests. again the action of filling the form is the same across features, in that case you can create a file with a single function that will take care of it for you, it will take as parameters the values you need and the submit, then you just need to import it into each feature and use instead of having this kind of repetition:
https://github.com/kaoskeya/codeacademy-tdd-vidbits/blob/master/test/features/user-visiting-landing-page-test.js#L40-L44

a way that the file with the function might look like is this:

const fillFormAndSubmit = (browser, {title, description, url}) => {
  if (typeof title !== 'undefined') {
    browser.setValue('[name=title]', title);
  }

  if (typeof description !== 'undefined') {
    browser.setValue('[name=description]', description);
  }

  if (typeof url !== 'undefined') {
    browser.setValue('[name=url]', url);
  }

  browser.click('[type=submit]');
};

module.exports = {fillFormAndSubmit};

And then you just need to import:
const {fillFormAndSubmit} = require('./utilities');
in each feature test file and implement it:

describe('User deleting video', () => {
  it('removes the Video from the list', () => {
    const title = 'This video will not exist for very long';
    const url = generateRandomUrl('example.com');

 browser.url('/videos/create');
    fillFormAndSubmit(browser, {title, url});
    browser.click('#delete');
...

server/routes/models

Great work! Everything is set pretty well, something I could say is that whenever you find yourself writing the same thing a few times through different methods, you might be able to turn it into a function that you can pass to every method. like in this case:
https://github.com/kaoskeya/codeacademy-tdd-vidbits/blob/master/routes/index.js#L41-L45

which you can separate like:


const findVideo = async (request) => {
  const {id} = request.params;

  return await Video.findOne({ _id: id });
}

const buildVideo = (video, {title, description, url}) => {
  video.title = title;
  video.description = description;
  video.url = url;

  video.validateSync();
};

and later call it in your method like:

router.post('/videos/:id/updates', async (request, response) => {
  const video = await findVideo(request);

  buildVideo(video, request.body);
// then your if statement and so on...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.