Code Monkey home page Code Monkey logo

Comments (11)

emersion avatar emersion commented on May 25, 2024 1

So a typical workflow is:

  • A track is playing, a "Pause" button is shown
  • The user clicks the "Pause" button
  • The client calls the PlayPause dbus method
  • The app accepts this request and pauses the current track
  • The app updates the service state to notify that the current track is paused
  • The client figures out that the current track is now paused
  • The client changes the "Pause" button text to "Play"

That ensures that even if multiple clients are connected to the service, all actions are correctly synced across them.

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024 1

We have an integration test suite now. Run with npm run test.

from mpris-service.

YurySolovyov avatar YurySolovyov commented on May 25, 2024

It really depends on what module does and how can we make sure that it does what it should.
E.g. for databases that would be check that inserted rows are persisted and can be queried.
Sorry if this kind of obvious, maybe you can give some insight on how can we for example make sure that our service sets proper variables or keeps some state.

Another approach would be to just mock everything and test against pure mock, but this is kind of self-delusion.

from mpris-service.

emersion avatar emersion commented on May 25, 2024

This service just offers:

  • Data about the current playback state
  • Methods to change the playback state

So we would need a dbus client which checks that returned data is correct and that the right methods are called with the right arguments. We could do this with the dbus module directly.

Mocking everything seems not a very good approach.

from mpris-service.

YurySolovyov avatar YurySolovyov commented on May 25, 2024

mm, isn't calling

Methods to change the playback state

would change

Data about the current playback state

?

from mpris-service.

emersion avatar emersion commented on May 25, 2024

No, because calling methods are requests to change the playback state, and apps using the service must process those requests and explicitly update the playback state themselves. Apps can reject some requests (like clicking "Next" when there is no more tracks in the play queue).

from mpris-service.

YurySolovyov avatar YurySolovyov commented on May 25, 2024

Right, so we need to implement some kind of test client as you suggested, to listen to these events and which we can ask for current state.

from mpris-service.

YurySolovyov avatar YurySolovyov commented on May 25, 2024

I need this module as part of martpie/museeks#93, maybe you can join our gitter channel and we can talk?

from mpris-service.

emersion avatar emersion commented on May 25, 2024

The problem is: which library should we use to write the test client? If we want to switch to the native implementation, it would be unfortunate to use the dbus bindings for tests. Maybe first write tests with the native implementation, and then switch the whole library to native?

from mpris-service.

YurySolovyov avatar YurySolovyov commented on May 25, 2024

Maybe first write tests with the native implementation, and then switch the whole library to native?

+1 for that, we can also learn the library itself in the process

from mpris-service.

emersion avatar emersion commented on May 25, 2024

Okay, so I'll create a branch for that and give you push access to it, to be able to work collaboratively.

from mpris-service.

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.