cody-music
Version:
mac osx spotify and itunes music player controller, spotify audio features, itunes and spotify genre, and playlist control
41 lines • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const expect = require("chai").expect;
const CodyMusic = require("../../index");
const util_1 = require("../util");
const date_fns_1 = require("date-fns");
/**
* Don't add "async" into the it condition.
* i.e. it("description text", async (done) => {
* // do stuff
* });
* It will return the following error if you do.
* "Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both."
*/
describe("recently playing tracks tests", () => {
before(() => {
new util_1.TestUtil().initializeSpotifyConfig();
});
beforeEach(() => {
//
});
it("Get tracks after time", async () => {
const limit = 10;
const after = (0, date_fns_1.getTime)(new Date());
const resp = await CodyMusic.getSpotifyRecentlyPlayedAfter(limit, after);
expect(resp.data.tracks.length).to.equal(0);
});
it("Get tracks before time without limit", async () => {
const limit = -1;
const before = (0, date_fns_1.getTime)(new Date());
const resp = await CodyMusic.getSpotifyRecentlyPlayedBefore(limit, before);
expect(resp.data.tracks.length).to.not.equal(0);
});
it("Get tracks with limit", async () => {
const limit = 2;
const before = (0, date_fns_1.getTime)(new Date());
const resp = await CodyMusic.getSpotifyRecentlyPlayedBefore(limit, before);
expect(resp.data.tracks.length).to.equal(2);
});
});
//# sourceMappingURL=test.js.map