diff --git a/spec/featured-spec.coffee b/spec/featured-spec.coffee deleted file mode 100644 index 8f64c180..00000000 --- a/spec/featured-spec.coffee +++ /dev/null @@ -1,55 +0,0 @@ -path = require 'path' -express = require 'express' -http = require 'http' -apm = require '../lib/apm-cli' - -describe 'apm featured', -> - server = null - - beforeEach -> - silenceOutput() - spyOnToken() - - app = express() - app.get '/packages/featured', (request, response) -> - response.sendFile path.join(__dirname, 'fixtures', 'packages.json') - app.get '/themes/featured', (request, response) -> - response.sendFile path.join(__dirname, 'fixtures', 'themes.json') - server = http.createServer(app) - - live = false - server.listen 3000, '127.0.0.1', -> - process.env.ATOM_API_URL = "http://localhost:3000" - live = true - waitsFor -> live - - afterEach -> - done = false - server.close -> done = true - waitsFor -> done - - it 'lists the featured packages and themes', -> - callback = jasmine.createSpy('callback') - apm.run(['featured'], callback) - - waitsFor 'waiting for command to complete', -> - callback.callCount > 0 - - runs -> - expect(console.log).toHaveBeenCalled() - expect(console.log.argsForCall[1][0]).toContain 'beverly-hills' - expect(console.log.argsForCall[2][0]).toContain 'multi-version' - expect(console.log.argsForCall[3][0]).toContain 'duckblur' - - describe 'when the theme flag is specified', -> - it "lists the featured themes", -> - callback = jasmine.createSpy('callback') - apm.run(['featured', '--themes'], callback) - - waitsFor 'waiting for command to complete', -> - callback.callCount > 0 - - runs -> - expect(console.log).toHaveBeenCalled() - expect(console.log.argsForCall[1][0]).toContain 'duckblur' - expect(console.log.argsForCall[2][0]).toBeUndefined() diff --git a/spec/featured-spec.js b/spec/featured-spec.js index 366f7e60..22a537f3 100644 --- a/spec/featured-spec.js +++ b/spec/featured-spec.js @@ -1,63 +1,65 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md - */ const path = require('path'); const express = require('express'); const http = require('http'); const apm = require('../lib/apm-cli'); -describe('apm featured', function() { +describe('apm featured', () => { let server = null; - beforeEach(function() { + beforeEach(() => { silenceOutput(); spyOnToken(); - const app = express(); - app.get('/packages/featured', (request, response) => response.sendFile(path.join(__dirname, 'fixtures', 'packages.json'))); - app.get('/themes/featured', (request, response) => response.sendFile(path.join(__dirname, 'fixtures', 'themes.json'))); + + app.get('/packages/featured', (request, response) => { + response.sendFile(path.join(__dirname, 'fixtures', 'packages.json')); + }); + + app.get('/themes/featured', (request, response) => { + response.sendFile(path.join(__dirname, 'fixtures', 'themes.json')); + }); + server = http.createServer(app); - let live = false; - server.listen(3000, '127.0.0.1', function() { - process.env.ATOM_API_URL = "http://localhost:3000"; - return live = true; + + server.listen(3000, '127.0.0.1', () => { + process.env.ATOM_API_URL = 'http://localhost:3000'; + live = true; }); - return waitsFor(() => live); + + waitsFor(() => live); }); - afterEach(function() { + afterEach(() => { let done = false; - server.close(() => done = true); - return waitsFor(() => done); + server.close(() => { + done = true; + }); + waitsFor(() => done); }); - it('lists the featured packages and themes', function() { + it('lists the featured packages and themes', () => { const callback = jasmine.createSpy('callback'); apm.run(['featured'], callback); - waitsFor('waiting for command to complete', () => callback.callCount > 0); - - return runs(function() { + runs(() => { expect(console.log).toHaveBeenCalled(); expect(console.log.argsForCall[1][0]).toContain('beverly-hills'); expect(console.log.argsForCall[2][0]).toContain('multi-version'); - return expect(console.log.argsForCall[3][0]).toContain('duckblur'); + expect(console.log.argsForCall[3][0]).toContain('duckblur'); }); }); - return describe('when the theme flag is specified', () => it("lists the featured themes", function() { - const callback = jasmine.createSpy('callback'); - apm.run(['featured', '--themes'], callback); - - waitsFor('waiting for command to complete', () => callback.callCount > 0); - - return runs(function() { - expect(console.log).toHaveBeenCalled(); - expect(console.log.argsForCall[1][0]).toContain('duckblur'); - return expect(console.log.argsForCall[2][0]).toBeUndefined(); + describe('when the theme flag is specified', () => { + it('lists the featured themes', () => { + const callback = jasmine.createSpy('callback'); + apm.run(['featured', '--themes'], callback); + waitsFor('waiting for command to complete', () => callback.callCount > 0); + runs(() => { + expect(console.log).toHaveBeenCalled(); + expect(console.log.argsForCall[1][0]).toContain('duckblur'); + expect(console.log.argsForCall[2][0]).toBeUndefined(); + }); }); - })); + }); });