Code Monkey home page Code Monkey logo

Comments (7)

Vidlec avatar Vidlec commented on May 21, 2024 1

I was writing tests to cover missing branches and found out that in
src/utils/templates/getAreasList.js

      const propValue = sanitizeTemplateString(props[propName])
      const nextAreas = propValue ? res.areas.concat(propValue) : res.areas

propValue can be never undefined or false because sanitizeTemplateString always returns an array.

So either check for array length or remove this check.
What do you think?

from atomic-layout.

kettanaito avatar kettanaito commented on May 21, 2024

Added unit tests for invariant function: a6bb237

from atomic-layout.

kettanaito avatar kettanaito commented on May 21, 2024

@Vidlec You are completely right!

[].concat(2) // [2]
// is indeed the same as
[].concat([2]) // [2]

Yes, we should remove that check and just concat the received sanitized template string to res.areas.

If you can, you can add that via pull request, that would be massively appreciated! If not, just create a ticket so we don't forget about that.


Also, ❤️ for increasing test coverage.

from atomic-layout.

Vidlec avatar Vidlec commented on May 21, 2024

There is a one last thing to have 100% coverage

if (prefix === 'min') {
      if (includesArea) {
        if (behavesSame || behavesInclusive) {
          nextValue = breakpointB[propName]
        }
      } else {
        if (shouldStretch) {
          nextValue = breakpointB[propName]
        }
      }
    }

That else branch is uncovered. I dont dare writing test for this, because I have no idea how this works 😃

from atomic-layout.

kettanaito avatar kettanaito commented on May 21, 2024

@Vidlec 😄

I think this is mergeBreakpoints function, isn't it?
That fires when you merge a minABC property of the breakpoint and the template declaration doesn't include the current area, and this area must be stretched. I doubt that makes the picture any cleaner for you...

I can explain you in person, just ping me anytime. It's nothing complicated, I promise.

from atomic-layout.

kettanaito avatar kettanaito commented on May 21, 2024

Test coverage has increased to 100% by merging your pull request #47.

Much thanks and welcome to contributors!

from atomic-layout.

kettanaito avatar kettanaito commented on May 21, 2024

@Vidlec Please let me know if we should reopen this issue to have that last branch covered. I have overlooked the comment and have already closed it. Sorry.

from atomic-layout.

Related Issues (20)

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.