No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. geddy
    G
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Groups 0

    geddy

    @geddy

    0
    Reputation
    3
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    geddy Follow

    Latest posts made by geddy

    • RE: Unit Testing - How to mock $q.platform.is.[...]?

      Fixed my own issue.

      I created a computed property - isDesktop() - that returns “this.$q.platform.is.desktop”. Then within my test file, I dynamically updated the computed property that then allowed me to test the functionality.

      I defined a factory function that is then called in beforeEach().

      const factory = (computed = { }) => {
      return shallowMount(App, {
      computed
      });
      };

      beforeEach(() => {
      wrapper = factory();
      });

      For the test that requires the updated computer property, I then called the factory function and set the computed property value.

      it(‘my amazing test’, () => {
      wrapper = factory({
      isDesktop: () => false
      });

      expect(addYourAssertionHere)
      })

      posted in Help
      G
      geddy
    • Unit Testing - How to mock $q.platform.is.[...]?

      Hello,

      I am creating unit tests for my Quasar app via the Jest app extension but I am struggling to work out how I can simulate the user being on a desktop/mobile via $q.platform.is.desktop. As I am running the tests on a desktop computer, $q.platform.is.desktop always returns true, but I want to modify this to return false - how can this be done?

      How can I mock $q.platform so that I am able to expand on my tests cases to include these scenarios as my code is conditional and acts based on the users platform.

      Thank you,
      geddy

      posted in Help
      G
      geddy