Coder Social home page Coder Social logo

workshop-argentesting's Introduction

export class Person {

  constructor(
    public name: string,
    public lastname: string,
    public age: number,
    public weight: number,
    public height: number
  ) {}

  calcIMG() {
  }
}

```

describe('test for data', () => {

it('attributes', () => {
  expect(person.name).toEqual('nicolas');
  expect(person.lastname).toEqual('molina');
  expect(person.age).toEqual(23);
  expect(person.weight).toEqual(40);
  expect(person.height).toEqual(1.65);
});

});


describe('test for calcIMC', () => {

it('should return a string: down', () => {
  person.weight = 40;
  expect(person.calcIMC()).toEqual('down');
});

it('should return a string: normal', () => {
  person.weight = 58;
  expect(person.calcIMC()).toEqual('normal');
});

it('should return a string: overweight', () => {
  person.weight = 68;
  expect(person.calcIMC()).toEqual('overweight');
});

it('should return a string: overweight level 1', () => {
  person.weight = 75;
  expect(person.calcIMC()).toEqual('overweight level 1');
});

it('should return a string: overweight level 2', () => {
  person.weight = 90;
  expect(person.calcIMC()).toEqual('overweight level 2');
});

it('should return a string: overweight level 3', () => {
  person.weight = 120;
  expect(person.calcIMC()).toEqual('overweight level 3');
});

it('should return a string: no found', () => {
  person.weight = -48;
  expect(person.calcIMC()).toEqual('no found');
  person.weight = -48;
  person.height = -1.70;
  expect(person.calcIMC()).toEqual('no found');
});

});


calcIMC(): string { const result = Math.round(this.weight / ((this.height) * (this.height))); if (result < 18) { return 'down'; } else if (result >= 18 && result <= 24) { return 'normal'; } else if (result >= 25 && result <= 26) { return 'overweight'; } else if (result >= 27 && result <= 29) { return 'overweight level 1'; } else if (result >= 30 && result <= 39) { return 'overweight level 2'; } else if (result >= 40) { return 'overweight level 3'; } }


calcIMC(): string { const result = Math.round(this.weight / ((this.height) * (this.height))); if (result < 0) { return 'no found'; } else if (result >= 0 && result < 18) { return 'down'; } else if (result >= 18 && result <= 24) { return 'normal'; } else if (result >= 25 && result <= 26) { return 'overweight'; } else if (result >= 27 && result <= 29) { return 'overweight level 1'; } else if (result >= 30 && result <= 39) { return 'overweight level 2'; } else if (result >= 40) { return 'overweight level 3'; } }

workshop-argentesting's People

Contributors

nicobytes avatar

Watchers

James Cloos avatar  avatar  avatar

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.