+ describe('publishTickets', function () {
+ beforeEach(function () {
+ options = {
+ queues: {
+ ticketRedeemedName: 'queue',
+ },
+ };
+ stubDb.ticketTokenGetUnpublished.resolves([{
+ ticket: 'xxxTICKETxxx',
+ resource: 'https://resource.example.com/',
+ subject: 'https://subject.example.com/',
+ iss: null,
+ }]);
+ chores = new Chores(stubLogger, stubDb, stubQueuePublisher, options);
+ });
+ it('publishes a ticket', async function () {
+ await chores.publishTickets();
+ assert(stubQueuePublisher.publish.called);
+ assert(stubDb.ticketTokenPublished.called);
+ });
+ it('covers error', async function () {
+ stubQueuePublisher.publish.rejects(expectedException);
+ await chores.publishTickets();
+ assert(stubQueuePublisher.publish.called);
+ assert(stubDb.ticketTokenPublished.notCalled);
+ });
+ }); // publishTickets
+
+}); // Chores