diff --git a/app/adapters/application.js b/app/adapters/application.js index e19611bb8d2..edbd2fe8b56 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -7,7 +7,7 @@ export default RESTAdapter.extend({ namespace: 'api/v1', - headers: computed('fastboot.{isFastBoot,request.headers}', function() { + headers: computed('fastboot.{isFastBoot,request.headers}', function () { if (this.fastboot.isFastBoot) { return { 'User-Agent': this.fastboot.request.headers.get('User-Agent') }; } diff --git a/app/components/badge-appveyor.js b/app/components/badge-appveyor.js index 450e4cd0328..8a8c9a6a198 100644 --- a/app/components/badge-appveyor.js +++ b/app/components/badge-appveyor.js @@ -7,7 +7,7 @@ export default Component.extend({ id: alias('badge.attributes.id'), repository: alias('badge.attributes.repository'), - imageUrl: computed('badge.attributes.id', function() { + imageUrl: computed('badge.attributes.id', function () { let id = this.get('badge.attributes.id'); let branch = this.branch; if (id !== undefined && id !== null) { @@ -20,19 +20,19 @@ export default Component.extend({ } }), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return this.get('badge.attributes.branch') || 'master'; }), - projectName: computed('badge.attributes.project_name', function() { + projectName: computed('badge.attributes.project_name', function () { return this.get('badge.attributes.project_name') || this.get('badge.attributes.repository').replace(/[_.]/g, '-'); }), - service: computed('badge.attributes.service', function() { + service: computed('badge.attributes.service', function () { return this.get('badge.attributes.service') || 'github'; }), - text: computed('badge', function() { + text: computed('badge', function () { return `Appveyor build status for the ${this.branch} branch`; }), }); diff --git a/app/components/badge-azure-devops.js b/app/components/badge-azure-devops.js index 4c12d20f527..2594a8ebe60 100644 --- a/app/components/badge-azure-devops.js +++ b/app/components/badge-azure-devops.js @@ -7,11 +7,11 @@ export default Component.extend({ project: alias('badge.attributes.project'), pipeline: alias('badge.attributes.pipeline'), - build: computed('badge.attributes.build', function() { + build: computed('badge.attributes.build', function () { return this.get('badge.attributes.build') || '1'; }), - text: computed('pipeline', function() { + text: computed('pipeline', function () { return `Azure Devops build status for the ${this.pipeline} pipeline`; }), }); diff --git a/app/components/badge-bitbucket-pipelines.js b/app/components/badge-bitbucket-pipelines.js index 183c794e67d..e94d057405c 100644 --- a/app/components/badge-bitbucket-pipelines.js +++ b/app/components/badge-bitbucket-pipelines.js @@ -6,11 +6,11 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return encodeURIComponent(this.get('badge.attributes.branch')); }), - text: computed('badge.attributes.branch', function() { + text: computed('badge.attributes.branch', function () { const branch = this.get('badge.attributes.branch'); return `Bitbucket Pipelines build status for the ${branch} branch`; }), diff --git a/app/components/badge-circle-ci.js b/app/components/badge-circle-ci.js index 1343a520db8..604ab7cd790 100644 --- a/app/components/badge-circle-ci.js +++ b/app/components/badge-circle-ci.js @@ -6,11 +6,11 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return encodeURIComponent(this.get('badge.attributes.branch') || 'master'); }), - text: computed('branch', function() { + text: computed('branch', function () { return `Circle CI build status for the ${this.branch} branch`; }), }); diff --git a/app/components/badge-cirrus-ci.js b/app/components/badge-cirrus-ci.js index 41cff789344..9d0eb6c2f73 100644 --- a/app/components/badge-cirrus-ci.js +++ b/app/components/badge-cirrus-ci.js @@ -6,11 +6,11 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return encodeURIComponent(this.get('badge.attributes.branch') || 'master'); }), - text: computed('branch', function() { + text: computed('branch', function () { return `Cirrus CI build status for the ${this.branch} branch`; }), }); diff --git a/app/components/badge-codecov.js b/app/components/badge-codecov.js index 183236fe683..eeef5b3d5ae 100644 --- a/app/components/badge-codecov.js +++ b/app/components/badge-codecov.js @@ -6,15 +6,15 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return this.get('badge.attributes.branch') || 'master'; }), - service: computed('badge.attributes.service', function() { + service: computed('badge.attributes.service', function () { return this.get('badge.attributes.service') || 'github'; }), - text: computed('branch', function() { + text: computed('branch', function () { return `CodeCov coverage status for the ${this.branch} branch`; }), }); diff --git a/app/components/badge-coveralls.js b/app/components/badge-coveralls.js index c9cda1aee60..3e71b7983fa 100644 --- a/app/components/badge-coveralls.js +++ b/app/components/badge-coveralls.js @@ -6,15 +6,15 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return this.get('badge.attributes.branch') || 'master'; }), - service: computed('badge.attributes.service', function() { + service: computed('badge.attributes.service', function () { return this.get('badge.attributes.service') || 'github'; }), - text: computed('branch', function() { + text: computed('branch', function () { return `Coveralls coverage status for the ${this.branch} branch`; }), }); diff --git a/app/components/badge-gitlab.js b/app/components/badge-gitlab.js index ccfdb4afa06..f362ac3b161 100644 --- a/app/components/badge-gitlab.js +++ b/app/components/badge-gitlab.js @@ -6,11 +6,11 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return this.get('badge.attributes.branch') || 'master'; }), - text: computed('badge', function() { + text: computed('badge', function () { return `GitLab build status for the ${this.branch} branch`; }), }); diff --git a/app/components/badge-is-it-maintained-issue-resolution.js b/app/components/badge-is-it-maintained-issue-resolution.js index 0d3136a169f..05481509ac4 100644 --- a/app/components/badge-is-it-maintained-issue-resolution.js +++ b/app/components/badge-is-it-maintained-issue-resolution.js @@ -6,7 +6,7 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - text: computed('badge', function() { + text: computed('badge', function () { return `Is It Maintained average time to resolve an issue`; }), }); diff --git a/app/components/badge-is-it-maintained-open-issues.js b/app/components/badge-is-it-maintained-open-issues.js index 9b07ea665ee..f9731163e5a 100644 --- a/app/components/badge-is-it-maintained-open-issues.js +++ b/app/components/badge-is-it-maintained-open-issues.js @@ -6,7 +6,7 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - text: computed('badge', function() { + text: computed('badge', function () { return `Is It Maintained percentage of issues still open`; }), }); diff --git a/app/components/badge-maintenance.js b/app/components/badge-maintenance.js index 40223a0ca36..467d0c3c0b8 100644 --- a/app/components/badge-maintenance.js +++ b/app/components/badge-maintenance.js @@ -5,18 +5,18 @@ import { alias } from '@ember/object/computed'; export default Component.extend({ tagName: '', - escapedStatus: computed('badge', function() { + escapedStatus: computed('badge', function () { return this.get('badge.attributes.status').replace(/-/g, '--'); }), - none: computed('badge', function() { + none: computed('badge', function () { return this.get('badge.attributes.status') === 'none' || !this.get('badge.attributes.status'); }), status: alias('badge.attributes.status'), // eslint-disable-next-line ember/require-return-from-computed - color: computed('badge', function() { + color: computed('badge', function () { switch (this.get('badge.attributes.status')) { case 'actively-developed': return 'brightgreen'; diff --git a/app/components/badge-travis-ci.js b/app/components/badge-travis-ci.js index 3c4a78179f9..f401cca888d 100644 --- a/app/components/badge-travis-ci.js +++ b/app/components/badge-travis-ci.js @@ -6,11 +6,11 @@ export default Component.extend({ tagName: '', repository: alias('badge.attributes.repository'), - branch: computed('badge.attributes.branch', function() { + branch: computed('badge.attributes.branch', function () { return this.get('badge.attributes.branch') || 'master'; }), - text: computed('branch', function() { + text: computed('branch', function () { return `Travis CI build status for the ${this.branch} branch`; }), }); diff --git a/app/components/crate-badge.js b/app/components/crate-badge.js index e796e09b451..5f5e2f5a967 100644 --- a/app/components/crate-badge.js +++ b/app/components/crate-badge.js @@ -4,11 +4,11 @@ import { computed } from '@ember/object'; export default Component.extend({ tagName: '', - version: computed('crate.max_version', function() { + version: computed('crate.max_version', function () { return this.get('crate.max_version').replace('-', '--'); }), - color: computed('crate.max_version', function() { + color: computed('crate.max_version', function () { if (this.get('crate.max_version')[0] == '0') { return 'orange'; } else { diff --git a/app/components/crate-row.js b/app/components/crate-row.js index daa12e1597d..9cc7a9034d6 100644 --- a/app/components/crate-row.js +++ b/app/components/crate-row.js @@ -3,7 +3,7 @@ import { computed } from '@ember/object'; export default Component.extend({ tagName: '', - crateTomlText: computed('crate.name', 'max_version', function() { + crateTomlText: computed('crate.name', 'max_version', function () { return `${this.get('crate.name')} = "${this.get('crate.max_version')}"`; }), }); diff --git a/app/components/download-graph.js b/app/components/download-graph.js index 4420dc6c252..a5b315028a3 100644 --- a/app/components/download-graph.js +++ b/app/components/download-graph.js @@ -95,8 +95,8 @@ export default Component.extend({ // use a DataView to calculate an x-day moving average let days = 7; let view = new window.google.visualization.DataView(myData); - let moving_avg_func_for_col = function(col) { - return function(dt, row) { + let moving_avg_func_for_col = function (col) { + return function (dt, row) { // For the last rows (the *first* days, remember, the dataset is // backwards), we cannot calculate the avg. of previous days. if (row >= dt.getNumberOfRows() - days) { diff --git a/app/components/dropdown.js b/app/components/dropdown.js index 17110b4ff36..1e3819be13c 100644 --- a/app/components/dropdown.js +++ b/app/components/dropdown.js @@ -7,7 +7,7 @@ export default Component.extend(EKMixin, EKOnInsertMixin, { dropdownExpanded: false, - onEscape: on(keyDown('Escape'), function() { + onEscape: on(keyDown('Escape'), function () { this.set('dropdownExpanded', false); }), diff --git a/app/components/dropdown/trigger.js b/app/components/dropdown/trigger.js index 7523be64f69..578c999a476 100644 --- a/app/components/dropdown/trigger.js +++ b/app/components/dropdown/trigger.js @@ -6,11 +6,11 @@ export default Component.extend({ attributeBindings: ['type', 'role', 'disabled'], - type: computed('tagName', function() { + type: computed('tagName', function () { return this.tagName === 'button' ? 'button' : null; }), - role: computed('tagName', function() { + role: computed('tagName', function () { return this.tagName === 'a' ? 'button' : null; }), diff --git a/app/components/email-input.js b/app/components/email-input.js index 737d4a3bc41..2ec54d25f8d 100644 --- a/app/components/email-input.js +++ b/app/components/email-input.js @@ -15,12 +15,12 @@ export default Component.extend({ notValidEmail: false, prevEmail: '', - emailIsNull: computed('user.email', function() { + emailIsNull: computed('user.email', function () { let email = this.get('user.email'); return email == null; }), - emailNotVerified: computed('user.{email,email_verified}', function() { + emailNotVerified: computed('user.{email,email_verified}', function () { let email = this.get('user.email'); let verified = this.get('user.email_verified'); @@ -31,7 +31,7 @@ export default Component.extend({ emailError: '', disableResend: false, - resendButtonText: computed('disableResend', 'user.email_verification_sent', function() { + resendButtonText: computed('disableResend', 'user.email_verification_sent', function () { if (this.disableResend) { return 'Sent!'; } else if (this.get('user.email_verification_sent')) { @@ -44,7 +44,7 @@ export default Component.extend({ actions: { editEmail() { let email = this.value; - let isEmailNull = function(email) { + let isEmailNull = function (email) { return email == null; }; @@ -57,7 +57,7 @@ export default Component.extend({ let userEmail = this.value; let user = this.user; - let emailIsProperFormat = function(userEmail) { + let emailIsProperFormat = function (userEmail) { let regExp = /^\S+@\S+\.\S+$/; return regExp.test(userEmail); }; diff --git a/app/components/follow-button.js b/app/components/follow-button.js index b23d29f6c9a..c6ed791d67e 100644 --- a/app/components/follow-button.js +++ b/app/components/follow-button.js @@ -11,13 +11,13 @@ export default class extends Component { this.followStateTask.perform(); } - @(task(function*() { + @(task(function* () { let d = yield ajax(`/api/v1/crates/${this.args.crate.name}/following`); this.following = d.following; }).drop()) followStateTask; - @task(function*() { + @task(function* () { let crate = this.args.crate; if (!this.following) { diff --git a/app/components/owned-crate-row.js b/app/components/owned-crate-row.js index d9b65eac02b..fbb06845cd6 100644 --- a/app/components/owned-crate-row.js +++ b/app/components/owned-crate-row.js @@ -6,7 +6,7 @@ export default Component.extend({ tagName: '', name: alias('ownedCrate.name'), - controlId: computed('ownedCrate.id', function() { + controlId: computed('ownedCrate.id', function () { return `${this.ownedCrate.id}-email-notifications`; }), emailNotifications: alias('ownedCrate.email_notifications'), diff --git a/app/components/user-avatar.js b/app/components/user-avatar.js index ef98e9af231..0d6e9bf939f 100644 --- a/app/components/user-avatar.js +++ b/app/components/user-avatar.js @@ -8,7 +8,7 @@ export default Component.extend({ attributeBindings: ['src', 'width', 'height', 'alt'], tagName: 'img', - width: computed('size', function() { + width: computed('size', function () { if (this.size === 'small') { return 22; } else if (this.size === 'medium-small') { @@ -20,11 +20,11 @@ export default Component.extend({ height: readOnly('width'), - alt: computed('user', function() { + alt: computed('user', function () { return `${this.get('user.name')} (${this.get('user.login')})`; }), - src: computed('size', 'user', function() { + src: computed('size', 'user', function () { return `${this.get('user.avatar')}&s=${this.width * 2}`; }), }); diff --git a/app/controllers/application.js b/app/controllers/application.js index cfc53bd09b1..dc2af438f29 100644 --- a/app/controllers/application.js +++ b/app/controllers/application.js @@ -12,7 +12,7 @@ export default Controller.extend(EKMixin, { keyboardActivated: true, - focusSearch: on(keyDown('KeyS'), keyPress('KeyS'), keyDown('shift+KeyS'), function(event) { + focusSearch: on(keyDown('KeyS'), keyPress('KeyS'), keyDown('shift+KeyS'), function (event) { if (event.ctrlKey || event.altKey || event.metaKey) { return; } diff --git a/app/controllers/categories.js b/app/controllers/categories.js index 625c2e9529d..f81635c10e7 100644 --- a/app/controllers/categories.js +++ b/app/controllers/categories.js @@ -12,7 +12,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { return this.sort === 'crates' ? '# Crates' : 'Alphabetical'; }), }); diff --git a/app/controllers/category/index.js b/app/controllers/category/index.js index 6f3da1dd57d..00da96d5021 100644 --- a/app/controllers/category/index.js +++ b/app/controllers/category/index.js @@ -14,7 +14,7 @@ export default Controller.extend(PaginationMixin, { category: null, - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { if (this.sort === 'downloads') { return 'All-Time Downloads'; } else if (this.sort === 'alpha') { diff --git a/app/controllers/crate/version.js b/app/controllers/crate/version.js index 6e12054536e..ecfee3d322b 100644 --- a/app/controllers/crate/version.js +++ b/app/controllers/crate/version.js @@ -16,36 +16,36 @@ export default Controller.extend({ isDownloading: false, - downloadsContext: computed('requestedVersion', 'model', 'crate', function() { + downloadsContext: computed('requestedVersion', 'model', 'crate', function () { return this.requestedVersion ? this.model : this.crate; }), downloads: alias('downloadsContext.version_downloads'), extraDownloads: alias('downloads.content.meta.extra_downloads'), currentVersion: alias('model'), - crateTomlText: computed('crate.name', 'currentVersion.num', function() { + crateTomlText: computed('crate.name', 'currentVersion.num', function () { return `${this.get('crate.name')} = "${this.get('currentVersion.num')}"`; }), requestedVersion: null, keywords: alias('crate.keywords'), categories: alias('crate.categories'), badges: alias('crate.badges'), - isOwner: computed('crate.owner_user', 'session.currentUser.id', function() { + isOwner: computed('crate.owner_user', 'session.currentUser.id', function () { return this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id')); }), - notYankedOrIsOwner: computed('model', 'crate.owner_user', 'session.currentUser.id', function() { + notYankedOrIsOwner: computed('model', 'crate.owner_user', 'session.currentUser.id', function () { return !this.get('model').yanked || this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id')); }), sortedVersions: readOnly('crate.versions'), - smallSortedVersions: computed('sortedVersions', function() { + smallSortedVersions: computed('sortedVersions', function () { return this.sortedVersions.slice(0, NUM_VERSIONS); }), hasMoreVersions: gt('sortedVersions.length', NUM_VERSIONS), - displayedAuthors: computed('currentVersion.authors.[]', function() { + displayedAuthors: computed('currentVersion.authors.[]', function () { return PromiseArray.create({ promise: this.get('currentVersion.authors').then(authors => { let ret = authors.slice(); @@ -61,7 +61,7 @@ export default Controller.extend({ anyKeywords: gt('keywords.length', 0), anyCategories: gt('categories.length', 0), - currentDependencies: computed('currentVersion.dependencies', function() { + currentDependencies: computed('currentVersion.dependencies', function () { let deps = this.get('currentVersion.dependencies'); if (deps === null) { @@ -73,7 +73,7 @@ export default Controller.extend({ }); }), - currentBuildDependencies: computed('currentVersion.dependencies', function() { + currentBuildDependencies: computed('currentVersion.dependencies', function () { let deps = this.get('currentVersion.dependencies'); if (deps === null) { @@ -85,7 +85,7 @@ export default Controller.extend({ }); }), - currentDevDependencies: computed('currentVersion.dependencies', function() { + currentDevDependencies: computed('currentVersion.dependencies', function () { let deps = this.get('currentVersion.dependencies'); if (deps === null) { return []; @@ -95,7 +95,7 @@ export default Controller.extend({ }); }), - downloadData: computed('downloads', 'extraDownloads', 'requestedVersion', function() { + downloadData: computed('downloads', 'extraDownloads', 'requestedVersion', function () { let downloads = this.downloads; if (!downloads) { return; @@ -112,9 +112,7 @@ export default Controller.extend({ downloads.forEach(d => { let version_id = d.get('version.id'); - let key = moment(d.get('date')) - .utc() - .format('MMM D'); + let key = moment(d.get('date')).utc().format('MMM D'); if (dates[key]) { let prev = dates[key].cnt[version_id] || 0; dates[key].cnt[version_id] = prev + d.get('downloads'); @@ -122,9 +120,7 @@ export default Controller.extend({ }); extra.forEach(d => { - let key = moment(d.date) - .utc() - .format('MMM D'); + let key = moment(d.date).utc().format('MMM D'); if (dates[key]) { let prev = dates[key].cnt[null] || 0; dates[key].cnt[null] = prev + d.downloads; @@ -162,7 +158,7 @@ export default Controller.extend({ }), // eslint-disable-next-line ember/no-observers - report: observer('crate.readme', function() { + report: observer('crate.readme', function () { if (typeof document === 'undefined') { return; } diff --git a/app/controllers/crates.js b/app/controllers/crates.js index ba0b68eaa8f..565d72c7a21 100644 --- a/app/controllers/crates.js +++ b/app/controllers/crates.js @@ -14,7 +14,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { if (this.sort === 'downloads') { return 'All-Time Downloads'; } else if (this.sort === 'recent-downloads') { diff --git a/app/controllers/dashboard.js b/app/controllers/dashboard.js index 81b6fbfb9b6..421ebf400c8 100644 --- a/app/controllers/dashboard.js +++ b/app/controllers/dashboard.js @@ -17,23 +17,23 @@ export default Controller.extend({ this.myStats = 0; }, - visibleCrates: computed('myCrates.[]', function() { + visibleCrates: computed('myCrates.[]', function () { return this.myCrates.slice(0, TO_SHOW); }), - visibleFollowing: computed('myFollowing.[]', function() { + visibleFollowing: computed('myFollowing.[]', function () { return this.myFollowing.slice(0, TO_SHOW); }), - visibleStats: computed('myStats', function() { + visibleStats: computed('myStats', function () { return this.myStats; }), - hasMoreCrates: computed('myCrates.[]', function() { + hasMoreCrates: computed('myCrates.[]', function () { return this.get('myCrates.length') > TO_SHOW; }), - hasMoreFollowing: computed('myFollowing.[]', function() { + hasMoreFollowing: computed('myFollowing.[]', function () { return this.get('myFollowing.length') > TO_SHOW; }), diff --git a/app/controllers/keyword/index.js b/app/controllers/keyword/index.js index dd5d78a9b90..bb03eebbb75 100644 --- a/app/controllers/keyword/index.js +++ b/app/controllers/keyword/index.js @@ -12,7 +12,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { if (this.sort === 'downloads') { return 'All-Time Downloads'; } else if (this.sort === 'alpha') { diff --git a/app/controllers/keywords.js b/app/controllers/keywords.js index 4dec3969e28..f45c9e39266 100644 --- a/app/controllers/keywords.js +++ b/app/controllers/keywords.js @@ -12,7 +12,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { return this.sort === 'crates' ? '# Crates' : 'Alphabetical'; }), }); diff --git a/app/controllers/me/crates.js b/app/controllers/me/crates.js index 4cdb5cb4ec8..205152f3fdd 100644 --- a/app/controllers/me/crates.js +++ b/app/controllers/me/crates.js @@ -14,7 +14,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { if (this.sort === 'downloads') { return 'All-Time Downloads'; } else if (this.sort === 'recent-downloads') { diff --git a/app/controllers/me/following.js b/app/controllers/me/following.js index 4d97fde6b61..c9a5fc3e171 100644 --- a/app/controllers/me/following.js +++ b/app/controllers/me/following.js @@ -14,7 +14,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { return this.sort === 'downloads' ? 'Downloads' : 'Alphabetical'; }), }); diff --git a/app/controllers/search.js b/app/controllers/search.js index 557284beab2..46b19ff93c4 100644 --- a/app/controllers/search.js +++ b/app/controllers/search.js @@ -16,17 +16,17 @@ export default Controller.extend(PaginationMixin, { model: readOnly('dataTask.lastSuccessful.value'), - hasData: computed('dataTask.{lastSuccessful,isRunning}', function() { + hasData: computed('dataTask.{lastSuccessful,isRunning}', function () { return this.get('dataTask.lastSuccessful') || !this.get('dataTask.isRunning'); }), - firstResultPending: computed('dataTask.{lastSuccessful,isRunning}', function() { + firstResultPending: computed('dataTask.{lastSuccessful,isRunning}', function () { return !this.get('dataTask.lastSuccessful') && this.get('dataTask.isRunning'); }), totalItems: readOnly('model.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { if (this.sort === 'downloads') { return 'All-Time Downloads'; } else if (this.sort === 'recent-downloads') { @@ -42,7 +42,7 @@ export default Controller.extend(PaginationMixin, { hasItems: bool('totalItems'), - dataTask: task(function*(params) { + dataTask: task(function* (params) { if (params.q !== null) { params.q = params.q.trim(); } diff --git a/app/controllers/team.js b/app/controllers/team.js index 23b19d6f233..f1c3a70b639 100644 --- a/app/controllers/team.js +++ b/app/controllers/team.js @@ -12,7 +12,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.crates.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { if (this.sort === 'downloads') { return 'All-Time Downloads'; } else if (this.sort === 'recent-downloads') { diff --git a/app/controllers/user.js b/app/controllers/user.js index ae1cb8ddd9c..7283eb0dcc6 100644 --- a/app/controllers/user.js +++ b/app/controllers/user.js @@ -13,7 +13,7 @@ export default Controller.extend(PaginationMixin, { totalItems: readOnly('model.crates.meta.total'), - currentSortBy: computed('sort', function() { + currentSortBy: computed('sort', function () { if (this.sort === 'downloads') { return 'All-Time Downloads'; } else if (this.sort === 'recent-downloads') { diff --git a/app/helpers/format-req.js b/app/helpers/format-req.js index 2e3740ea71a..d8dadeeb8a1 100644 --- a/app/helpers/format-req.js +++ b/app/helpers/format-req.js @@ -1,6 +1,6 @@ import { helper } from '@ember/component/helper'; -export default helper(function(params) { +export default helper(function (params) { let [req] = params; return req === '*' ? '' : req; }); diff --git a/app/helpers/truncate-text.js b/app/helpers/truncate-text.js index 029dde80fbe..cb879a2f34a 100644 --- a/app/helpers/truncate-text.js +++ b/app/helpers/truncate-text.js @@ -1,6 +1,6 @@ import { helper } from '@ember/component/helper'; -export default helper(function(params) { +export default helper(function (params) { let [value] = params; if (!value) { return value; diff --git a/app/initializers/hashchange.js b/app/initializers/hashchange.js index 13c14f5ac0d..8c91d9dd94a 100644 --- a/app/initializers/hashchange.js +++ b/app/initializers/hashchange.js @@ -35,12 +35,12 @@ export function initialize() { // If clicking on a link to the same fragment as currently in the address bar, // hashchange won't be fired, so we need to manually trigger rescroll. - document.addEventListener('click', function(event) { + document.addEventListener('click', function (event) { if (event.target.tagName !== 'A') { return; } if (this.href === location.href && location.hash.length > 1) { - setTimeout(function() { + setTimeout(function () { if (!event.defaultPrevented) { hashchange(); } diff --git a/app/mixins/pagination.js b/app/mixins/pagination.js index 1b656ea35a1..50cb27fac42 100644 --- a/app/mixins/pagination.js +++ b/app/mixins/pagination.js @@ -7,7 +7,7 @@ const VIEWABLE_PAGES = 9; // eslint-disable-next-line ember/no-new-mixins export default Mixin.create({ // Gives page numbers to the surrounding 9 pages. - pages: computed('currentPage', 'availablePages', function() { + pages: computed('currentPage', 'availablePages', function () { let pages = []; let currentPage = this.currentPage; let availablePages = this.availablePages; @@ -32,22 +32,22 @@ export default Mixin.create({ return pages; }), - currentPage: computed('selectedPage', function() { + currentPage: computed('selectedPage', function () { return parseInt(this.selectedPage, 10) || 1; }), - currentPageStart: computed('currentPage', 'itemsPerPage', 'totalItems', function() { + currentPageStart: computed('currentPage', 'itemsPerPage', 'totalItems', function () { if (this.totalItems === 0) { return 0; } return (this.currentPage - 1) * this.itemsPerPage + 1; }), - currentPageEnd: computed('currentPage', 'itemsPerPage', 'totalItems', function() { + currentPageEnd: computed('currentPage', 'itemsPerPage', 'totalItems', function () { return Math.min(this.currentPage * this.itemsPerPage, this.totalItems); }), - nextPage: computed('currentPage', 'availablePages', function() { + nextPage: computed('currentPage', 'availablePages', function () { let nextPage = this.currentPage + 1; let availablePages = this.availablePages; if (nextPage <= availablePages) { @@ -57,7 +57,7 @@ export default Mixin.create({ } }), - prevPage: computed('currentPage', function() { + prevPage: computed('currentPage', function () { let prevPage = this.currentPage - 1; if (prevPage > 0) { return prevPage; @@ -66,7 +66,7 @@ export default Mixin.create({ } }), - availablePages: computed('totalItems', 'itemsPerPage', function() { + availablePages: computed('totalItems', 'itemsPerPage', function () { return Math.ceil(this.totalItems / this.itemsPerPage || 1); }), diff --git a/app/models/team.js b/app/models/team.js index e0278de189d..8d1a82a9df3 100644 --- a/app/models/team.js +++ b/app/models/team.js @@ -9,12 +9,12 @@ export default Model.extend({ avatar: attr('string'), url: attr('string'), kind: attr('string'), - org_name: computed('login', function() { + org_name: computed('login', function () { let login = this.login; let login_split = login.split(':'); return login_split[1]; }), - display_name: computed('name', 'org_name', function() { + display_name: computed('name', 'org_name', function () { let { name, org_name } = this.getProperties('name', 'org_name'); return `${org_name}/${name}`; }), diff --git a/app/models/version.js b/app/models/version.js index 5529c2498f5..85560556888 100644 --- a/app/models/version.js +++ b/app/models/version.js @@ -18,7 +18,7 @@ export default Model.extend({ dependencies: hasMany('dependency', { async: true }), version_downloads: hasMany('version-download', { async: true }), - crateName: computed('crate', function() { + crateName: computed('crate', function () { return this.belongsTo('crate').id(); }), crate_size: attr('number'), diff --git a/app/router.js b/app/router.js index ecc0e942a97..1215f605225 100644 --- a/app/router.js +++ b/app/router.js @@ -6,13 +6,13 @@ export default class Router extends RouterScroll { rootURL = config.rootURL; } -Router.map(function() { +Router.map(function () { this.route('logout'); this.route('login'); this.route('github-login', { path: 'github_login' }); this.route('github-authorize', { path: '/authorize/github' }); this.route('crates'); - this.route('crate', { path: '/crates/:crate_id' }, function() { + this.route('crate', { path: '/crates/:crate_id' }, function () { this.route('download'); this.route('versions'); this.route('version', { path: '/:version_num' }); @@ -25,7 +25,7 @@ Router.map(function() { this.route('docs'); this.route('repo'); }); - this.route('me', function() { + this.route('me', function () { this.route('crates'); this.route('following'); this.route('pending-invites'); @@ -35,11 +35,11 @@ Router.map(function() { this.route('search'); this.route('dashboard'); this.route('keywords'); - this.route('keyword', { path: '/keywords/:keyword_id' }, function() { + this.route('keyword', { path: '/keywords/:keyword_id' }, function () { this.route('index', { path: '/' }); }); this.route('categories'); - this.route('category', { path: '/categories/:category_id' }, function() { + this.route('category', { path: '/categories/:category_id' }, function () { this.route('index', { path: '/' }); }); this.route('category-slugs', { path: 'category_slugs' }); diff --git a/app/routes/crate/version.js b/app/routes/crate/version.js index aa60e53434e..e5a692d3017 100644 --- a/app/routes/crate/version.js +++ b/app/routes/crate/version.js @@ -13,7 +13,7 @@ export default Route.extend({ flashMessages: service(), // eslint-disable-next-line ember/no-observers - refreshAfterLogin: observer('session.isLoggedIn', function() { + refreshAfterLogin: observer('session.isLoggedIn', function () { this.refresh(); }), diff --git a/app/routes/me/index.js b/app/routes/me/index.js index b35a921b122..302ad20eda5 100644 --- a/app/routes/me/index.js +++ b/app/routes/me/index.js @@ -4,7 +4,7 @@ import AuthenticatedRoute from '../../mixins/authenticated-route'; export default Route.extend(AuthenticatedRoute, { actions: { - willTransition: function() { + willTransition: function () { this.controller .setProperties({ emailNotificationsSuccess: false, diff --git a/app/services/fetcher.js b/app/services/fetcher.js index 165d27f0b6e..86755ca7d07 100644 --- a/app/services/fetcher.js +++ b/app/services/fetcher.js @@ -16,7 +16,7 @@ export default class FetcherService extends Service { return cache[url]; } - return ajax(url).then(function(resp) { + return ajax(url).then(function (resp) { if (shoebox && fastboot.isFastBoot) { cache[url] = deepCopy(resp); shoebox.put('ajax-cache', cache); diff --git a/config/environment.js b/config/environment.js index 7c463cb69cf..c9d2b603e84 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,6 +1,6 @@ 'use strict'; -module.exports = function(environment) { +module.exports = function (environment) { let ENV = { modulePrefix: 'cargo', environment, diff --git a/config/manifest.js b/config/manifest.js index a41cc5e1fdf..92e73f479b5 100644 --- a/config/manifest.js +++ b/config/manifest.js @@ -1,6 +1,6 @@ 'use strict'; -module.exports = function(/* environment, appConfig */) { +module.exports = function (/* environment, appConfig */) { return { name: 'crates.io: Rust Package Registry', short_name: 'crates.io', diff --git a/ember-cli-build.js b/ember-cli-build.js index 9fbbf6623e2..1ac4f1b8e42 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -2,7 +2,7 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app'); -module.exports = function(defaults) { +module.exports = function (defaults) { const highlightedLanguages = [ 'bash', 'clike', diff --git a/fastboot.js b/fastboot.js index 297832c1fd5..45a757a91d0 100644 --- a/fastboot.js +++ b/fastboot.js @@ -32,7 +32,7 @@ class LoggerWithoutTimestamp { function writeAppInitializedWhenReady(logger) { let timeout; - timeout = setInterval(function() { + timeout = setInterval(function () { logger.writeLine('waiting backend'); if (fs.existsSync('/tmp/backend-initialized')) { logger.writeLine('backend is up. let heroku know the app is ready'); diff --git a/mirage/config.js b/mirage/config.js index bab84eb872c..676f8c4a23b 100644 --- a/mirage/config.js +++ b/mirage/config.js @@ -6,7 +6,7 @@ import * as Summary from './route-handlers/summary'; import * as Teams from './route-handlers/teams'; import * as Users from './route-handlers/users'; -export default function() { +export default function () { Categories.register(this); Crates.register(this); DocsRS.register(this); diff --git a/mirage/route-handlers/categories.js b/mirage/route-handlers/categories.js index d8fdc9fd209..f288954a136 100644 --- a/mirage/route-handlers/categories.js +++ b/mirage/route-handlers/categories.js @@ -1,7 +1,7 @@ import { pageParams, compareStrings, withMeta, notFound } from './-utils'; export function register(server) { - server.get('/api/v1/categories', function(schema, request) { + server.get('/api/v1/categories', function (schema, request) { let { start, end } = pageParams(request); let allCategories = schema.categories.all().sort((a, b) => compareStrings(a.category, b.category)); @@ -11,13 +11,13 @@ export function register(server) { return withMeta(this.serialize(categories), { total }); }); - server.get('/api/v1/categories/:category_id', function(schema, request) { + server.get('/api/v1/categories/:category_id', function (schema, request) { let catId = request.params.category_id; let category = schema.categories.find(catId); return category ? category : notFound(); }); - server.get('/api/v1/category_slugs', function(schema) { + server.get('/api/v1/category_slugs', function (schema) { let allCategories = schema.categories.all().sort((a, b) => compareStrings(a.category, b.category)); return { category_slugs: this.serialize(allCategories).categories.map(cat => ({ diff --git a/mirage/route-handlers/crates.js b/mirage/route-handlers/crates.js index 375674c12ca..1b33ef8721d 100644 --- a/mirage/route-handlers/crates.js +++ b/mirage/route-handlers/crates.js @@ -1,7 +1,7 @@ import { pageParams, compareStrings, withMeta, compareIsoDates, notFound } from './-utils'; export function register(server) { - server.get('/api/v1/crates', function(schema, request) { + server.get('/api/v1/crates', function (schema, request) { const { start, end } = pageParams(request); let crates = schema.crates.all(); @@ -33,7 +33,7 @@ export function register(server) { return withMeta(this.serialize(crates.slice(start, end)), { total: crates.length }); }); - server.get('/api/v1/crates/:crate_id', function(schema, request) { + server.get('/api/v1/crates/:crate_id', function (schema, request) { let crateId = request.params.crate_id; let crate = schema.crates.find(crateId); if (!crate) return notFound(); @@ -82,7 +82,7 @@ export function register(server) { return schema.dependencies.where({ versionId: version.id }); }); - server.get('/api/v1/crates/:crate_id/:version_num/downloads', function(schema, request) { + server.get('/api/v1/crates/:crate_id/:version_num/downloads', function (schema, request) { let crateId = request.params.crate_id; let crate = schema.crates.find(crateId); if (!crate) return notFound(); @@ -94,7 +94,7 @@ export function register(server) { return schema.versionDownloads.where({ versionId: version.id }); }); - server.get('/api/v1/crates/:crate_id/owner_user', function(schema, request) { + server.get('/api/v1/crates/:crate_id/owner_user', function (schema, request) { let crateId = request.params.crate_id; let crate = schema.crates.find(crateId); if (!crate) return notFound(); @@ -108,7 +108,7 @@ export function register(server) { return response; }); - server.get('/api/v1/crates/:crate_id/owner_team', function(schema, request) { + server.get('/api/v1/crates/:crate_id/owner_team', function (schema, request) { let crateId = request.params.crate_id; let crate = schema.crates.find(crateId); if (!crate) return notFound(); @@ -122,7 +122,7 @@ export function register(server) { return response; }); - server.get('/api/v1/crates/:crate_id/reverse_dependencies', function(schema, request) { + server.get('/api/v1/crates/:crate_id/reverse_dependencies', function (schema, request) { let crateId = request.params.crate_id; let crate = schema.crates.find(crateId); if (!crate) return notFound(); @@ -142,7 +142,7 @@ export function register(server) { }; }); - server.get('/api/v1/crates/:crate_id/downloads', function(schema, request) { + server.get('/api/v1/crates/:crate_id/downloads', function (schema, request) { let crateId = request.params.crate_id; let crate = schema.crates.find(crateId); if (!crate) return notFound(); diff --git a/mirage/route-handlers/docs-rs.js b/mirage/route-handlers/docs-rs.js index e22dbdd3e3c..43e1e6465ec 100644 --- a/mirage/route-handlers/docs-rs.js +++ b/mirage/route-handlers/docs-rs.js @@ -1,5 +1,5 @@ export function register(server) { - server.get('https://docs.rs/crate/:crate/:version/builds.json', function() { + server.get('https://docs.rs/crate/:crate/:version/builds.json', function () { return []; }); } diff --git a/mirage/route-handlers/keywords.js b/mirage/route-handlers/keywords.js index 21a5420ee6b..8dd8fba62fa 100644 --- a/mirage/route-handlers/keywords.js +++ b/mirage/route-handlers/keywords.js @@ -1,7 +1,7 @@ import { pageParams, withMeta, notFound } from './-utils'; export function register(server) { - server.get('/api/v1/keywords', function(schema, request) { + server.get('/api/v1/keywords', function (schema, request) { let { start, end } = pageParams(request); let allKeywords = schema.keywords.all().sort((a, b) => a.crates_cnt - b.crates_cnt); diff --git a/mirage/route-handlers/summary.js b/mirage/route-handlers/summary.js index 91cc0c11f58..cc186ad32a9 100644 --- a/mirage/route-handlers/summary.js +++ b/mirage/route-handlers/summary.js @@ -1,7 +1,7 @@ import { compareIsoDates } from './-utils'; export function register(server) { - server.get('/api/v1/summary', function(schema) { + server.get('/api/v1/summary', function (schema) { let crates = schema.crates.all(); let just_updated = crates.sort((a, b) => compareIsoDates(b.updated_at, a.updated_at)).slice(0, 10); diff --git a/mirage/scenarios/default.js b/mirage/scenarios/default.js index 5031608679b..9902cfb297d 100644 --- a/mirage/scenarios/default.js +++ b/mirage/scenarios/default.js @@ -1,3 +1,3 @@ -export default function(server) { +export default function (server) { server.loadFixtures(); } diff --git a/package-lock.json b/package-lock.json index b124456cb86..7c9bdd2d9d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45841,9 +45841,9 @@ } }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.1.tgz", + "integrity": "sha512-piXGBcY1zoFOG0MvHpNE5reAGseLmaCRifQ/fmfF49BcYkInEs/naD/unxGNAeOKFA5+JxVrPyMvMlpzcd20UA==", "dev": true }, "prettier-linter-helpers": { diff --git a/package.json b/package.json index 38bea5a4cb6..612ae02c833 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "test-coverage": "COVERAGE=true npm run test && ember coverage-merge && rm -rf coverage_* coverage/coverage-summary.json && nyc report" }, "prettier": { + "arrowParens": "avoid", "printWidth": 120, "singleQuote": true, "tabWidth": 2, @@ -98,7 +99,7 @@ "loader.js": "^4.7.0", "normalize.css": "^8.0.1", "nyc": "^15.0.0", - "prettier": "^1.19.1", + "prettier": "^2.0.1", "qunit-console-grouper": "^0.2.0", "qunit-dom": "^1.1.0", "sass": "^1.26.3", diff --git a/tests/acceptance/api-token-test.js b/tests/acceptance/api-token-test.js index ad0db902e8f..3e1afa5f40e 100644 --- a/tests/acceptance/api-token-test.js +++ b/tests/acceptance/api-token-test.js @@ -8,7 +8,7 @@ import { percySnapshot } from 'ember-percy'; import setupMirage from '../helpers/setup-mirage'; import { visit } from '../helpers/visit-ignoring-abort'; -module('Acceptance | api-tokens', function(hooks) { +module('Acceptance | api-tokens', function (hooks) { setupApplicationTest(hooks); setupWindowMock(hooks); setupMirage(hooks); @@ -43,7 +43,7 @@ module('Acceptance | api-tokens', function(hooks) { }); } - test('/me is showing the list of active API tokens', async function(assert) { + test('/me is showing the list of active API tokens', async function (assert) { prepare(this); await visit('/me'); @@ -70,10 +70,10 @@ module('Acceptance | api-tokens', function(hooks) { assert.dom('[data-test-token]', row2).doesNotExist(); }); - test('API tokens can be revoked', async function(assert) { + test('API tokens can be revoked', async function (assert) { prepare(this); - this.server.delete('/api/v1/me/tokens/:id', function(schema, request) { + this.server.delete('/api/v1/me/tokens/:id', function (schema, request) { assert.step(`delete id:${request.params.id}`); return {}; }); @@ -90,10 +90,10 @@ module('Acceptance | api-tokens', function(hooks) { assert.dom('[data-test-error]').doesNotExist(); }); - test('failed API tokens revocation shows an error', async function(assert) { + test('failed API tokens revocation shows an error', async function (assert) { prepare(this); - this.server.delete('/api/v1/me/tokens/:id', function() { + this.server.delete('/api/v1/me/tokens/:id', function () { return new Response(500, {}, {}); }); @@ -108,10 +108,10 @@ module('Acceptance | api-tokens', function(hooks) { assert.dom('[data-test-error]').includesText('An error occurred while revoking this token'); }); - test('new API tokens can be created', async function(assert) { + test('new API tokens can be created', async function (assert) { prepare(this); - this.server.put('/api/v1/me/tokens', function(schema, request) { + this.server.put('/api/v1/me/tokens', function (schema, request) { assert.step('put'); let { api_token } = JSON.parse(request.requestBody); diff --git a/tests/acceptance/categories-test.js b/tests/acceptance/categories-test.js index 43b87ca224c..3867c250da3 100644 --- a/tests/acceptance/categories-test.js +++ b/tests/acceptance/categories-test.js @@ -6,11 +6,11 @@ import axeConfig from '../axe-config'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | categories', function(hooks) { +module('Acceptance | categories', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - test('is accessible', async function(assert) { + test('is accessible', async function (assert) { assert.expect(0); this.server.create('category', { category: 'API bindings' }); @@ -23,7 +23,7 @@ module('Acceptance | categories', function(hooks) { await a11yAudit(axeConfig); }); - test('category/:category_id is accessible', async function(assert) { + test('category/:category_id is accessible', async function (assert) { assert.expect(0); this.server.create('category', { category: 'Algorithms' }); @@ -34,7 +34,7 @@ module('Acceptance | categories', function(hooks) { await a11yAudit(axeConfig); }); - test('listing categories', async function(assert) { + test('listing categories', async function (assert) { this.server.create('category', { category: 'API bindings' }); this.server.create('category', { category: 'Algorithms' }); this.server.createList('crate', 1, { categoryIds: ['algorithms'] }); @@ -48,7 +48,7 @@ module('Acceptance | categories', function(hooks) { assert.dom('[data-test-category="asynchronous"] [data-test-crate-count]').hasText('15 crates'); }); - test('category/:category_id index default sort is recent-downloads', async function(assert) { + test('category/:category_id index default sort is recent-downloads', async function (assert) { this.server.create('category', { category: 'Algorithms' }); await visit('/categories/algorithms'); @@ -56,7 +56,7 @@ module('Acceptance | categories', function(hooks) { assert.dom('[data-test-category-sort] [data-test-current-order]').hasText('Recent Downloads'); }); - test('listing category slugs', async function(assert) { + test('listing category slugs', async function (assert) { this.server.create('category', { category: 'Algorithms', description: 'Crates for algorithms' }); this.server.create('category', { category: 'Asynchronous', description: 'Async crates' }); diff --git a/tests/acceptance/crate-following-test.js b/tests/acceptance/crate-following-test.js index 45ff94f2302..5133f9993e4 100644 --- a/tests/acceptance/crate-following-test.js +++ b/tests/acceptance/crate-following-test.js @@ -6,7 +6,7 @@ import { defer } from 'rsvp'; import setupMirage from '../helpers/setup-mirage'; -module('Acceptance | Crate following', function(hooks) { +module('Acceptance | Crate following', function (hooks) { setupApplicationTest(hooks); setupWindowMock(hooks); setupMirage(hooks); @@ -36,14 +36,14 @@ module('Acceptance | Crate following', function(hooks) { } } - test("unauthenticated users don't see the follow button", async function(assert) { + test("unauthenticated users don't see the follow button", async function (assert) { prepare(this, { loggedIn: false }); await visit('/crates/nanomsg'); assert.dom('[data-test-follow-button]').doesNotExist(); }); - test('authenticated users see a loading spinner and can follow/unfollow crates', async function(assert) { + test('authenticated users see a loading spinner and can follow/unfollow crates', async function (assert) { prepare(this); let followingDeferred = defer(); diff --git a/tests/acceptance/crate-test.js b/tests/acceptance/crate-test.js index a9309ea4fa3..6b872e1d174 100644 --- a/tests/acceptance/crate-test.js +++ b/tests/acceptance/crate-test.js @@ -8,11 +8,11 @@ import { title } from '../helpers/dom'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | crate page', function(hooks) { +module('Acceptance | crate page', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - test('/crates/:crate is accessible', async function(assert) { + test('/crates/:crate is accessible', async function (assert) { assert.expect(0); this.server.create('crate', { name: 'nanomsg' }); @@ -25,7 +25,7 @@ module('Acceptance | crate page', function(hooks) { await a11yAudit(axeConfig); }); - test('/crates/:crate/:version is accessible', async function(assert) { + test('/crates/:crate/:version is accessible', async function (assert) { assert.expect(0); this.server.create('crate', { name: 'nanomsg' }); @@ -38,7 +38,7 @@ module('Acceptance | crate page', function(hooks) { await a11yAudit(axeConfig); }); - test('/crates/:crate/owners is accessible', async function(assert) { + test('/crates/:crate/owners is accessible', async function (assert) { assert.expect(0); this.server.loadFixtures(); @@ -49,7 +49,7 @@ module('Acceptance | crate page', function(hooks) { await a11yAudit(axeConfig); }); - test('visiting a crate page from the front page', async function(assert) { + test('visiting a crate page from the front page', async function (assert) { this.server.create('crate', { name: 'nanomsg', newest_version: '0.6.1' }); this.server.create('version', { crateId: 'nanomsg', num: '0.6.1' }); @@ -63,7 +63,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.1'); }); - test('visiting /crates/nanomsg', async function(assert) { + test('visiting /crates/nanomsg', async function (assert) { this.server.create('crate', { name: 'nanomsg' }); this.server.create('version', { crateId: 'nanomsg', num: '0.6.0' }); this.server.create('version', { crateId: 'nanomsg', num: '0.6.1' }); @@ -79,7 +79,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview'); }); - test('visiting /crates/nanomsg/', async function(assert) { + test('visiting /crates/nanomsg/', async function (assert) { this.server.create('crate', { name: 'nanomsg' }); this.server.create('version', { crateId: 'nanomsg', num: '0.6.0' }); this.server.create('version', { crateId: 'nanomsg', num: '0.6.1' }); @@ -95,7 +95,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview'); }); - test('visiting /crates/nanomsg/0.6.0', async function(assert) { + test('visiting /crates/nanomsg/0.6.0', async function (assert) { this.server.create('crate', { name: 'nanomsg' }); this.server.create('version', { crateId: 'nanomsg', num: '0.6.0' }); this.server.create('version', { crateId: 'nanomsg', num: '0.6.1' }); @@ -111,7 +111,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview for 0.6.0 (see all)'); }); - test('navigating to the all versions page', async function(assert) { + test('navigating to the all versions page', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -120,7 +120,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('.info').hasText(/All 13\s+versions of nanomsg since\s+December \d+, 2014/); }); - test('navigating to the reverse dependencies page', async function(assert) { + test('navigating to the reverse dependencies page', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -130,7 +130,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('a[href="/crates/unicorn-rpc"]').hasText('unicorn-rpc'); }); - test('navigating to a user page', async function(assert) { + test('navigating to a user page', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -140,7 +140,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-heading] [data-test-username]').hasText('blabaere'); }); - test('navigating to a team page', async function(assert) { + test('navigating to a team page', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -150,7 +150,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-heading] [data-test-team-name]').hasText('thehydroimpulseteam'); }); - test('crates having normal dependencies', async function(assert) { + test('crates having normal dependencies', async function (assert) { this.server.loadFixtures(); await visit('crates/nanomsg'); @@ -158,7 +158,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('#crate-dependencies li').exists({ count: 2 }); }); - test('crates having build dependencies', async function(assert) { + test('crates having build dependencies', async function (assert) { this.server.loadFixtures(); await visit('crates/nanomsg'); @@ -166,7 +166,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('#crate-build-dependencies li').exists({ count: 1 }); }); - test('crates having dev dependencies', async function(assert) { + test('crates having dev dependencies', async function (assert) { this.server.loadFixtures(); await visit('crates/nanomsg'); @@ -174,7 +174,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('#crate-dev-dependencies li').exists({ count: 1 }); }); - test('crates having user-owners', async function(assert) { + test('crates having user-owners', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -186,7 +186,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-owners] li').exists({ count: 4 }); }); - test('crates having team-owners', async function(assert) { + test('crates having team-owners', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -195,7 +195,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-owners] li').exists({ count: 4 }); }); - test('crates license is supplied by version', async function(assert) { + test('crates license is supplied by version', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -205,7 +205,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-license]').hasText('MIT/Apache-2.0'); }); - test('navigating to the owners page when not logged in', async function(assert) { + test('navigating to the owners page when not logged in', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg'); @@ -213,7 +213,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('#crate-owners p a').doesNotExist(); }); - test('navigating to the owners page when not an owner', async function(assert) { + test('navigating to the owners page when not an owner', async function (assert) { this.server.loadFixtures(); this.owner.register( @@ -231,7 +231,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('#crate-owners p a').doesNotExist(); }); - test('navigating to the owners page', async function(assert) { + test('navigating to the owners page', async function (assert) { this.server.loadFixtures(); this.owner.register( @@ -250,7 +250,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('.crates-heading h1').hasText('Manage Crate Owners'); }); - test('listing crate owners', async function(assert) { + test('listing crate owners', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg/owners'); @@ -262,7 +262,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('a[href="/users/blabaere"]').exists(); }); - test('attempting to add owner without username', async function(assert) { + test('attempting to add owner without username', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg/owners'); @@ -273,7 +273,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('.owners .row').exists({ count: 4 }); }); - test('attempting to add non-existent owner', async function(assert) { + test('attempting to add non-existent owner', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg/owners'); @@ -285,7 +285,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('.owners .row').exists({ count: 4 }); }); - test('add a new owner', async function(assert) { + test('add a new owner', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg/owners'); @@ -297,7 +297,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('.owners .row').exists({ count: 4 }); }); - test('remove a crate owner when owner is a user', async function(assert) { + test('remove a crate owner when owner is a user', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg/owners'); @@ -307,7 +307,7 @@ module('Acceptance | crate page', function(hooks) { assert.dom('[data-test-owner-user]').exists({ count: 1 }); }); - test('remove a crate owner when owner is a team', async function(assert) { + test('remove a crate owner when owner is a team', async function (assert) { this.server.loadFixtures(); await visit('/crates/nanomsg/owners'); diff --git a/tests/acceptance/crates-test.js b/tests/acceptance/crates-test.js index 06033cca2b4..0c72685f3ff 100644 --- a/tests/acceptance/crates-test.js +++ b/tests/acceptance/crates-test.js @@ -7,14 +7,14 @@ import { title } from '../helpers/dom'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | crates page', function(hooks) { +module('Acceptance | crates page', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); // should match the default set in the crates controller const per_page = 50; - test('/crates is accessible', async function(assert) { + test('/crates is accessible', async function (assert) { assert.expect(0); this.server.loadFixtures(); @@ -25,7 +25,7 @@ module('Acceptance | crates page', function(hooks) { await a11yAudit(axeConfig); }); - test('visiting the crates page from the front page', async function(assert) { + test('visiting the crates page from the front page', async function (assert) { this.server.loadFixtures(); await visit('/'); @@ -35,7 +35,7 @@ module('Acceptance | crates page', function(hooks) { assert.equal(title(), 'Crates - crates.io: Rust Package Registry'); }); - test('visiting the crates page directly', async function(assert) { + test('visiting the crates page directly', async function (assert) { this.server.loadFixtures(); await visit('/crates'); @@ -45,7 +45,7 @@ module('Acceptance | crates page', function(hooks) { assert.equal(title(), 'Crates - crates.io: Rust Package Registry'); }); - test('listing crates', async function(assert) { + test('listing crates', async function (assert) { for (let i = 1; i <= per_page; i++) { let crate = this.server.create('crate'); this.server.create('version', { crate }); @@ -57,7 +57,7 @@ module('Acceptance | crates page', function(hooks) { assert.dom('[data-test-crates-nav] [data-test-total-rows]').hasText(`${per_page}`); }); - test('navigating to next page of crates', async function(assert) { + test('navigating to next page of crates', async function (assert) { for (let i = 1; i <= per_page + 2; i++) { let crate = this.server.create('crate'); this.server.create('version', { crate }); @@ -73,7 +73,7 @@ module('Acceptance | crates page', function(hooks) { assert.dom('[data-test-crates-nav] [data-test-total-rows]').hasText(`${total}`); }); - test('crates default sort is alphabetical', async function(assert) { + test('crates default sort is alphabetical', async function (assert) { this.server.loadFixtures(); await visit('/crates'); @@ -81,14 +81,14 @@ module('Acceptance | crates page', function(hooks) { assert.dom('[data-test-crates-sort] [data-test-current-order]').hasText('Alphabetical'); }); - test('downloads appears for each crate on crate list', async function(assert) { + test('downloads appears for each crate on crate list', async function (assert) { this.server.loadFixtures(); await visit('/crates'); assert.dom('[data-test-crate-row="0"] [data-test-downloads]').hasText('All-Time: 497'); }); - test('recent downloads appears for each crate on crate list', async function(assert) { + test('recent downloads appears for each crate on crate list', async function (assert) { this.server.loadFixtures(); await visit('/crates'); diff --git a/tests/acceptance/dashboard-test.js b/tests/acceptance/dashboard-test.js index c28f8dc5f57..d80bf0cd01c 100644 --- a/tests/acceptance/dashboard-test.js +++ b/tests/acceptance/dashboard-test.js @@ -7,18 +7,18 @@ import { percySnapshot } from 'ember-percy'; import setupMirage from '../helpers/setup-mirage'; import { visit } from '../helpers/visit-ignoring-abort'; -module('Acceptance | Dashboard', function(hooks) { +module('Acceptance | Dashboard', function (hooks) { setupApplicationTest(hooks); setupWindowMock(hooks); setupMirage(hooks); - test('redirects to / when not logged in', async function(assert) { + test('redirects to / when not logged in', async function (assert) { await visit('/dashboard'); assert.equal(currentURL(), '/'); assert.dom('[data-test-flash-message]').hasText('Please log in to proceed'); }); - test('shows the dashboard when logged in', async function(assert) { + test('shows the dashboard when logged in', async function (assert) { window.localStorage.setItem('isLoggedIn', '1'); { diff --git a/tests/acceptance/front-page-test.js b/tests/acceptance/front-page-test.js index fc38dbb840a..118b5fc307a 100644 --- a/tests/acceptance/front-page-test.js +++ b/tests/acceptance/front-page-test.js @@ -7,11 +7,11 @@ import { title } from '../helpers/dom'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | front page', function(hooks) { +module('Acceptance | front page', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - test('is accessible', async function(assert) { + test('is accessible', async function (assert) { assert.expect(0); this.server.loadFixtures(); @@ -20,7 +20,7 @@ module('Acceptance | front page', function(hooks) { await a11yAudit(axeConfig); }); - test('visiting /', async function(assert) { + test('visiting /', async function (assert) { this.server.loadFixtures(); await visit('/'); diff --git a/tests/acceptance/keyword-test.js b/tests/acceptance/keyword-test.js index ae4f96e3a49..99761c3c3e2 100644 --- a/tests/acceptance/keyword-test.js +++ b/tests/acceptance/keyword-test.js @@ -6,11 +6,11 @@ import axeConfig from '../axe-config'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | keywords', function(hooks) { +module('Acceptance | keywords', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - test('keyword/:keyword_id is accessible', async function(assert) { + test('keyword/:keyword_id is accessible', async function (assert) { assert.expect(0); this.server.create('keyword', { keyword: 'network' }); @@ -21,7 +21,7 @@ module('Acceptance | keywords', function(hooks) { await a11yAudit(axeConfig); }); - test('keyword/:keyword_id index default sort is recent-downloads', async function(assert) { + test('keyword/:keyword_id index default sort is recent-downloads', async function (assert) { this.server.create('keyword', { keyword: 'network' }); await visit('/keywords/network'); diff --git a/tests/acceptance/login-test.js b/tests/acceptance/login-test.js index f4aa3973a36..87b132c3da0 100644 --- a/tests/acceptance/login-test.js +++ b/tests/acceptance/login-test.js @@ -7,12 +7,12 @@ import window, { setupWindowMock } from 'ember-window-mock'; import flashStyles from 'cargo/components/flash-message.module.scss'; import setupMirage from '../helpers/setup-mirage'; -module('Acceptance | Login', function(hooks) { +module('Acceptance | Login', function (hooks) { setupApplicationTest(hooks); setupWindowMock(hooks); setupMirage(hooks); - test('successful login', async function(assert) { + test('successful login', async function (assert) { let deferred = defer(); let fakeWindow = { closed: false }; window.open = (url, target, features) => { @@ -56,7 +56,7 @@ module('Acceptance | Login', function(hooks) { assert.dom('[data-test-user-menu] [data-test-toggle]').hasText('John Doe'); }); - test('failed login', async function(assert) { + test('failed login', async function (assert) { let deferred = defer(); let fakeWindow = { closed: false }; window.open = () => { diff --git a/tests/acceptance/search-test.js b/tests/acceptance/search-test.js index 190188a85fd..26c2657fc91 100644 --- a/tests/acceptance/search-test.js +++ b/tests/acceptance/search-test.js @@ -8,11 +8,11 @@ import { title } from '../helpers/dom'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | search', function(hooks) { +module('Acceptance | search', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - test('/search?q=rust is accessible', async function(assert) { + test('/search?q=rust is accessible', async function (assert) { assert.expect(0); this.server.loadFixtures(); @@ -23,7 +23,7 @@ module('Acceptance | search', function(hooks) { await a11yAudit(axeConfig); }); - test('searching for "rust"', async function(assert) { + test('searching for "rust"', async function (assert) { this.server.loadFixtures(); await visit('/'); @@ -49,7 +49,7 @@ module('Acceptance | search', function(hooks) { assert.dom('[data-test-crate-row="0"] [data-test-updated-at]').exists(); }); - test('searching for "rust" from query', async function(assert) { + test('searching for "rust" from query', async function (assert) { this.server.loadFixtures(); await visit('/search?q=rust'); @@ -62,7 +62,7 @@ module('Acceptance | search', function(hooks) { assert.dom('[data-test-search-nav]').hasText('Displaying 1-7 of 7 total results'); }); - test('clearing search results', async function(assert) { + test('clearing search results', async function (assert) { this.server.loadFixtures(); await visit('/search?q=rust'); @@ -76,7 +76,7 @@ module('Acceptance | search', function(hooks) { assert.dom('[data-test-search-input]').hasValue(''); }); - test('pressing S key to focus the search bar', async function(assert) { + test('pressing S key to focus the search bar', async function (assert) { this.server.loadFixtures(); await visit('/'); @@ -98,7 +98,7 @@ module('Acceptance | search', function(hooks) { assert.dom('[data-test-search-input]').isFocused(); }); - test('check search results are by default displayed by relevance', async function(assert) { + test('check search results are by default displayed by relevance', async function (assert) { this.server.loadFixtures(); await visit('/'); diff --git a/tests/acceptance/team-page-test.js b/tests/acceptance/team-page-test.js index 2c0c6625539..0b3d83d4671 100644 --- a/tests/acceptance/team-page-test.js +++ b/tests/acceptance/team-page-test.js @@ -6,11 +6,11 @@ import axeConfig from '../axe-config'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | team page', function(hooks) { +module('Acceptance | team page', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - test('is accessible', async function(assert) { + test('is accessible', async function (assert) { assert.expect(0); this.server.loadFixtures(); @@ -21,7 +21,7 @@ module('Acceptance | team page', function(hooks) { await a11yAudit(axeConfig); }); - test('has team organization display', async function(assert) { + test('has team organization display', async function (assert) { this.server.loadFixtures(); await visit('/teams/github:org:thehydroimpulse'); @@ -30,7 +30,7 @@ module('Acceptance | team page', function(hooks) { assert.dom('[data-test-heading] [data-test-team-name]').hasText('thehydroimpulseteam'); }); - test('has link to github in team header', async function(assert) { + test('has link to github in team header', async function (assert) { this.server.loadFixtures(); await visit('/teams/github:org:thehydroimpulse'); @@ -38,7 +38,7 @@ module('Acceptance | team page', function(hooks) { assert.dom('[data-test-heading] [data-test-github-link]').hasAttribute('href', 'https://github.com/org_test'); }); - test('github link has image in team header', async function(assert) { + test('github link has image in team header', async function (assert) { this.server.loadFixtures(); await visit('/teams/github:org:thehydroimpulse'); @@ -46,7 +46,7 @@ module('Acceptance | team page', function(hooks) { assert.dom('[data-test-heading] [data-test-github-link] img').hasAttribute('src', '/assets/GitHub-Mark.svg'); }); - test('team organization details has github profile icon', async function(assert) { + test('team organization details has github profile icon', async function (assert) { this.server.loadFixtures(); await visit('/teams/github:org:thehydroimpulse'); diff --git a/tests/acceptance/user-page-test.js b/tests/acceptance/user-page-test.js index 2a05c412aec..3a1c979cfea 100644 --- a/tests/acceptance/user-page-test.js +++ b/tests/acceptance/user-page-test.js @@ -6,11 +6,11 @@ import axeConfig from '../axe-config'; import setupMirage from '../helpers/setup-mirage'; import { percySnapshot } from 'ember-percy'; -module('Acceptance | user page', function(hooks) { +module('Acceptance | user page', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - test('is accessible', async function(assert) { + test('is accessible', async function (assert) { assert.expect(0); this.server.loadFixtures(); @@ -21,7 +21,7 @@ module('Acceptance | user page', function(hooks) { await a11yAudit(axeConfig); }); - test('has user display', async function(assert) { + test('has user display', async function (assert) { this.server.loadFixtures(); await visit('/users/thehydroimpulse'); @@ -29,7 +29,7 @@ module('Acceptance | user page', function(hooks) { assert.dom('[data-test-heading] [data-test-username]').hasText('thehydroimpulse'); }); - test('has link to github in user header', async function(assert) { + test('has link to github in user header', async function (assert) { this.server.loadFixtures(); await visit('/users/thehydroimpulse'); @@ -37,7 +37,7 @@ module('Acceptance | user page', function(hooks) { assert.dom('[data-test-heading] [data-test-user-link]').hasAttribute('href', 'https://github.com/thehydroimpulse'); }); - test('github link has image in user header', async function(assert) { + test('github link has image in user header', async function (assert) { this.server.loadFixtures(); await visit('/users/thehydroimpulse'); @@ -45,7 +45,7 @@ module('Acceptance | user page', function(hooks) { assert.dom('[data-test-heading] [data-test-user-link] img').hasAttribute('src', '/assets/GitHub-Mark.svg'); }); - test('user details has github profile icon', async function(assert) { + test('user details has github profile icon', async function (assert) { this.server.loadFixtures(); await visit('/users/thehydroimpulse'); diff --git a/tests/helpers/setup-mirage.js b/tests/helpers/setup-mirage.js index 027a30dc667..08025d51163 100644 --- a/tests/helpers/setup-mirage.js +++ b/tests/helpers/setup-mirage.js @@ -1,15 +1,15 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import timekeeper from 'timekeeper'; -export default function(hooks) { +export default function (hooks) { setupMirage(hooks); // To have deterministic visual tests, the seed has to be constant - hooks.beforeEach(function() { + hooks.beforeEach(function () { timekeeper.freeze(new Date('11/20/2017 12:00')); }); - hooks.afterEach(function() { + hooks.afterEach(function () { timekeeper.reset(); }); } diff --git a/tests/integration/components/api-token-row-test.js b/tests/integration/components/api-token-row-test.js index 78201a52959..8bb6b098e4e 100644 --- a/tests/integration/components/api-token-row-test.js +++ b/tests/integration/components/api-token-row-test.js @@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; -module('Integration | Component | api-token-row', function(hooks) { +module('Integration | Component | api-token-row', function (hooks) { setupRenderingTest(hooks); - test('input is focused if token is new', async function(assert) { + test('input is focused if token is new', async function (assert) { // Set any properties with this.set('myProperty', 'value'); // Handle any actions with this.set('myAction', function(val) { ... }); this.set('api_token', { diff --git a/tests/mirage/categories-test.js b/tests/mirage/categories-test.js index f71ff04bfcf..f580e9753e4 100644 --- a/tests/mirage/categories-test.js +++ b/tests/mirage/categories-test.js @@ -4,12 +4,12 @@ import { module, test } from 'qunit'; import setupMirage from '../helpers/setup-mirage'; import fetch from 'fetch'; -module('Mirage | Categories', function(hooks) { +module('Mirage | Categories', function (hooks) { setupTest(hooks); setupMirage(hooks); - module('GET /api/v1/categories', function() { - test('empty case', async function(assert) { + module('GET /api/v1/categories', function () { + test('empty case', async function (assert) { let response = await fetch('/api/v1/categories'); assert.equal(response.status, 200); @@ -22,7 +22,7 @@ module('Mirage | Categories', function(hooks) { }); }); - test('returns a paginated categories list', async function(assert) { + test('returns a paginated categories list', async function (assert) { this.server.create('category', { category: 'no-std', description: 'Crates that are able to function without the Rust standard library.', @@ -66,7 +66,7 @@ module('Mirage | Categories', function(hooks) { }); }); - test('never returns more than 10 results', async function(assert) { + test('never returns more than 10 results', async function (assert) { this.server.createList('category', 25); let response = await fetch('/api/v1/categories'); @@ -77,7 +77,7 @@ module('Mirage | Categories', function(hooks) { assert.equal(responsePayload.meta.total, 25); }); - test('supports `page` and `per_page` parameters', async function(assert) { + test('supports `page` and `per_page` parameters', async function (assert) { this.server.createList('category', 25, { category: i => `cat-${String(i + 1).padStart(2, '0')}`, }); @@ -95,8 +95,8 @@ module('Mirage | Categories', function(hooks) { }); }); - module('GET /api/v1/categories/:id', function() { - test('returns 404 for unknown categories', async function(assert) { + module('GET /api/v1/categories/:id', function () { + test('returns 404 for unknown categories', async function (assert) { let response = await fetch('/api/v1/categories/foo'); assert.equal(response.status, 404); @@ -104,7 +104,7 @@ module('Mirage | Categories', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns a category object for known categories', async function(assert) { + test('returns a category object for known categories', async function (assert) { this.server.create('category', { category: 'no-std', description: 'Crates that are able to function without the Rust standard library.', @@ -126,7 +126,7 @@ module('Mirage | Categories', function(hooks) { }); }); - test('calculates `crates_cnt` correctly', async function(assert) { + test('calculates `crates_cnt` correctly', async function (assert) { this.server.create('category', { category: 'cli' }); this.server.createList('crate', 7, { categoryIds: ['cli'] }); this.server.create('category', { category: 'not-cli' }); @@ -149,8 +149,8 @@ module('Mirage | Categories', function(hooks) { }); }); - module('GET /api/v1/category_slugs', function() { - test('empty case', async function(assert) { + module('GET /api/v1/category_slugs', function () { + test('empty case', async function (assert) { let response = await fetch('/api/v1/category_slugs'); assert.equal(response.status, 200); @@ -160,7 +160,7 @@ module('Mirage | Categories', function(hooks) { }); }); - test('returns a category slugs list', async function(assert) { + test('returns a category slugs list', async function (assert) { this.server.create('category', { category: 'no-std', description: 'Crates that are able to function without the Rust standard library.', @@ -192,7 +192,7 @@ module('Mirage | Categories', function(hooks) { }); }); - test('has no pagination', async function(assert) { + test('has no pagination', async function (assert) { this.server.createList('category', 25); let response = await fetch('/api/v1/category_slugs'); diff --git a/tests/mirage/crates-test.js b/tests/mirage/crates-test.js index 78f51d5a279..5dfb697d1d4 100644 --- a/tests/mirage/crates-test.js +++ b/tests/mirage/crates-test.js @@ -4,12 +4,12 @@ import { module, test } from 'qunit'; import setupMirage from '../helpers/setup-mirage'; import fetch from 'fetch'; -module('Mirage | Crates', function(hooks) { +module('Mirage | Crates', function (hooks) { setupTest(hooks); setupMirage(hooks); - module('GET /api/v1/crates', function() { - test('empty case', async function(assert) { + module('GET /api/v1/crates', function () { + test('empty case', async function (assert) { let response = await fetch('/api/v1/crates'); assert.equal(response.status, 200); @@ -22,7 +22,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns a paginated crates list', async function(assert) { + test('returns a paginated crates list', async function (assert) { this.server.create('crate', { name: 'rand' }); this.server.create('version', { crateId: 'rand', num: '1.0.0' }); @@ -63,7 +63,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('never returns more than 10 results', async function(assert) { + test('never returns more than 10 results', async function (assert) { let crates = this.server.createList('crate', 25); this.server.createList('version', crates.length, { crate: i => crates[i] }); @@ -75,7 +75,7 @@ module('Mirage | Crates', function(hooks) { assert.equal(responsePayload.meta.total, 25); }); - test('supports `page` and `per_page` parameters', async function(assert) { + test('supports `page` and `per_page` parameters', async function (assert) { let crates = this.server.createList('crate', 25, { name: i => `crate-${String(i + 1).padStart(2, '0')}`, }); @@ -93,7 +93,7 @@ module('Mirage | Crates', function(hooks) { assert.equal(responsePayload.meta.total, 25); }); - test('supports a `letter` parameter', async function(assert) { + test('supports a `letter` parameter', async function (assert) { this.server.create('crate', { name: 'foo' }); this.server.create('version', { crateId: 'foo' }); this.server.create('crate', { name: 'bar' }); @@ -113,7 +113,7 @@ module('Mirage | Crates', function(hooks) { assert.equal(responsePayload.meta.total, 2); }); - test('supports a `q` parameter', async function(assert) { + test('supports a `q` parameter', async function (assert) { this.server.create('crate', { name: '123456' }); this.server.create('version', { crateId: '123456' }); this.server.create('crate', { name: '00123' }); @@ -133,7 +133,7 @@ module('Mirage | Crates', function(hooks) { assert.equal(responsePayload.meta.total, 2); }); - test('supports a `user_id` parameter', async function(assert) { + test('supports a `user_id` parameter', async function (assert) { this.server.create('crate', { name: 'foo' }); this.server.create('version', { crateId: 'foo' }); this.server.create('crate', { name: 'bar', _owner_users: [42] }); @@ -150,7 +150,7 @@ module('Mirage | Crates', function(hooks) { assert.equal(responsePayload.meta.total, 1); }); - test('supports a `team_id` parameter', async function(assert) { + test('supports a `team_id` parameter', async function (assert) { this.server.create('crate', { name: 'foo' }); this.server.create('version', { crateId: 'foo' }); this.server.create('crate', { name: 'bar', _owner_teams: [42] }); @@ -167,7 +167,7 @@ module('Mirage | Crates', function(hooks) { assert.equal(responsePayload.meta.total, 1); }); - test('supports a `team_id` parameter', async function(assert) { + test('supports a `team_id` parameter', async function (assert) { this.server.create('crate', { name: 'foo' }); this.server.create('version', { crateId: 'foo' }); this.server.create('crate', { name: 'bar', _owner_teams: [42] }); @@ -185,8 +185,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo'); assert.equal(response.status, 404); @@ -194,7 +194,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns a crate object for known crates', async function(assert) { + test('returns a crate object for known crates', async function (assert) { this.server.create('crate', { name: 'rand' }); this.server.create('version', { crateId: 'rand', num: '1.0.0' }); @@ -251,7 +251,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('includes related versions', async function(assert) { + test('includes related versions', async function (assert) { this.server.create('crate', { name: 'rand' }); this.server.create('version', { crateId: 'rand', num: '1.0.0' }); this.server.create('version', { crateId: 'rand', num: '1.1.0' }); @@ -317,7 +317,7 @@ module('Mirage | Crates', function(hooks) { ]); }); - test('includes related categories', async function(assert) { + test('includes related categories', async function (assert) { this.server.create('category', { category: 'no-std' }); this.server.create('category', { category: 'cli' }); this.server.create('crate', { name: 'rand', categoryIds: ['no-std'] }); @@ -340,7 +340,7 @@ module('Mirage | Crates', function(hooks) { ]); }); - test('includes related keywords', async function(assert) { + test('includes related keywords', async function (assert) { this.server.create('keyword', { keyword: 'no-std' }); this.server.create('keyword', { keyword: 'cli' }); this.server.create('crate', { name: 'rand', keywordIds: ['no-std'] }); @@ -361,8 +361,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/versions', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/versions', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/versions'); assert.equal(response.status, 404); @@ -370,7 +370,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/versions'); @@ -382,7 +382,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns all versions belonging to the specified crate', async function(assert) { + test('returns all versions belonging to the specified crate', async function (assert) { this.server.create('crate', { name: 'rand' }); this.server.create('version', { crateId: 'rand', num: '1.0.0' }); this.server.create('version', { crateId: 'rand', num: '1.1.0' }); @@ -450,8 +450,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/:version/authors', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/:version/authors', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/1.0.0/authors'); assert.equal(response.status, 404); @@ -459,7 +459,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns 200 for unknown versions', async function(assert) { + test('returns 200 for unknown versions', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/1.0.0/authors'); @@ -471,7 +471,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'crate `rand` does not have a version `1.0.0`' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); this.server.create('version', { crateId: 'rand', num: '1.0.0' }); @@ -487,7 +487,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns a list of authors belonging to the specified crate version', async function(assert) { + test('returns a list of authors belonging to the specified crate version', async function (assert) { let authors = ['John Doe ', 'The Rust Project Developers']; this.server.create('crate', { name: 'rand' }); @@ -506,8 +506,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/:version/dependencies', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/:version/dependencies', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/1.0.0/dependencies'); assert.equal(response.status, 404); @@ -515,7 +515,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns 200 for unknown versions', async function(assert) { + test('returns 200 for unknown versions', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/1.0.0/dependencies'); @@ -527,7 +527,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'crate `rand` does not have a version `1.0.0`' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); this.server.create('version', { crateId: 'rand', num: '1.0.0' }); @@ -540,7 +540,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns a list of dependencies belonging to the specified crate version', async function(assert) { + test('returns a list of dependencies belonging to the specified crate version', async function (assert) { this.server.create('crate', { name: 'rand' }); let version = this.server.create('version', { crateId: 'rand', num: '1.0.0' }); @@ -595,8 +595,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/:version/downloads', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/:version/downloads', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/1.0.0/downloads'); assert.equal(response.status, 404); @@ -604,7 +604,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns 200 for unknown versions', async function(assert) { + test('returns 200 for unknown versions', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/1.0.0/downloads'); @@ -616,7 +616,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'crate `rand` does not have a version `1.0.0`' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); this.server.create('version', { crateId: 'rand', num: '1.0.0' }); @@ -629,7 +629,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns a list of version downloads belonging to the specified crate version', async function(assert) { + test('returns a list of version downloads belonging to the specified crate version', async function (assert) { this.server.create('crate', { name: 'rand' }); let version = this.server.create('version', { crateId: 'rand', num: '1.0.0' }); this.server.create('version-download', { version, date: '2020-01-13' }); @@ -662,8 +662,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/owner_user', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/owner_user', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/owner_user'); assert.equal(response.status, 404); @@ -671,7 +671,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/owner_user'); @@ -683,7 +683,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns the list of users that own the specified crate', async function(assert) { + test('returns the list of users that own the specified crate', async function (assert) { let user = this.server.create('user', { name: 'John Doe' }); this.server.create('crate', { name: 'rand', userOwners: [user] }); @@ -706,8 +706,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/owner_team', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/owner_team', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/owner_team'); assert.equal(response.status, 404); @@ -715,7 +715,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/owner_team'); @@ -727,7 +727,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns the list of teams that own the specified crate', async function(assert) { + test('returns the list of teams that own the specified crate', async function (assert) { let team = this.server.create('team', { name: 'maintainers' }); this.server.create('crate', { name: 'rand', teamOwners: [team] }); @@ -750,8 +750,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/reverse_dependencies', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/reverse_dependencies', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/reverse_dependencies'); assert.equal(response.status, 404); @@ -759,7 +759,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/reverse_dependencies'); @@ -775,7 +775,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns a paginated list of crate versions depending to the specified crate', async function(assert) { + test('returns a paginated list of crate versions depending to the specified crate', async function (assert) { this.server.create('crate', { name: 'foo' }); this.server.create('dependency', { @@ -863,7 +863,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('never returns more than 10 results', async function(assert) { + test('never returns more than 10 results', async function (assert) { this.server.create('crate', { name: 'foo' }); this.server.createList('dependency', 25, { @@ -883,7 +883,7 @@ module('Mirage | Crates', function(hooks) { assert.equal(responsePayload.meta.total, 25); }); - test('supports `page` and `per_page` parameters', async function(assert) { + test('supports `page` and `per_page` parameters', async function (assert) { this.server.create('crate', { name: 'foo' }); let crates = this.server.createList('crate', 25, { @@ -911,8 +911,8 @@ module('Mirage | Crates', function(hooks) { }); }); - module('GET /api/v1/crates/:id/downloads', function() { - test('returns 404 for unknown crates', async function(assert) { + module('GET /api/v1/crates/:id/downloads', function () { + test('returns 404 for unknown crates', async function (assert) { let response = await fetch('/api/v1/crates/foo/downloads'); assert.equal(response.status, 404); @@ -920,7 +920,7 @@ module('Mirage | Crates', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('empty case', async function(assert) { + test('empty case', async function (assert) { this.server.create('crate', { name: 'rand' }); let response = await fetch('/api/v1/crates/rand/downloads'); @@ -935,7 +935,7 @@ module('Mirage | Crates', function(hooks) { }); }); - test('returns a list of version downloads belonging to the specified crate version', async function(assert) { + test('returns a list of version downloads belonging to the specified crate version', async function (assert) { this.server.create('crate', { name: 'rand' }); let versions = this.server.createList('version', 2, { crateId: 'rand' }); this.server.create('version-download', { version: versions[0], date: '2020-01-13' }); diff --git a/tests/mirage/keywords-test.js b/tests/mirage/keywords-test.js index 3c6294e1514..29a8de55b60 100644 --- a/tests/mirage/keywords-test.js +++ b/tests/mirage/keywords-test.js @@ -4,12 +4,12 @@ import { module, test } from 'qunit'; import setupMirage from '../helpers/setup-mirage'; import fetch from 'fetch'; -module('Mirage | Keywords', function(hooks) { +module('Mirage | Keywords', function (hooks) { setupTest(hooks); setupMirage(hooks); - module('GET /api/v1/keywords', function() { - test('empty case', async function(assert) { + module('GET /api/v1/keywords', function () { + test('empty case', async function (assert) { let response = await fetch('/api/v1/keywords'); assert.equal(response.status, 200); @@ -22,7 +22,7 @@ module('Mirage | Keywords', function(hooks) { }); }); - test('returns a paginated keywords list', async function(assert) { + test('returns a paginated keywords list', async function (assert) { this.server.create('keyword', { keyword: 'api' }); this.server.createList('keyword', 2); @@ -54,7 +54,7 @@ module('Mirage | Keywords', function(hooks) { }); }); - test('never returns more than 10 results', async function(assert) { + test('never returns more than 10 results', async function (assert) { this.server.createList('keyword', 25); let response = await fetch('/api/v1/keywords'); @@ -65,7 +65,7 @@ module('Mirage | Keywords', function(hooks) { assert.equal(responsePayload.meta.total, 25); }); - test('supports `page` and `per_page` parameters', async function(assert) { + test('supports `page` and `per_page` parameters', async function (assert) { this.server.createList('keyword', 25, { keyword: i => `k${String(i + 1).padStart(2, '0')}`, }); @@ -83,8 +83,8 @@ module('Mirage | Keywords', function(hooks) { }); }); - module('GET /api/v1/keywords/:id', function() { - test('returns 404 for unknown keywords', async function(assert) { + module('GET /api/v1/keywords/:id', function () { + test('returns 404 for unknown keywords', async function (assert) { let response = await fetch('/api/v1/keywords/foo'); assert.equal(response.status, 404); @@ -92,7 +92,7 @@ module('Mirage | Keywords', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns a keyword object for known keywords', async function(assert) { + test('returns a keyword object for known keywords', async function (assert) { this.server.create('keyword', { keyword: 'cli' }); let response = await fetch('/api/v1/keywords/cli'); @@ -108,7 +108,7 @@ module('Mirage | Keywords', function(hooks) { }); }); - test('calculates `crates_cnt` correctly', async function(assert) { + test('calculates `crates_cnt` correctly', async function (assert) { this.server.create('keyword', { keyword: 'cli' }); this.server.createList('crate', 7, { keywordIds: ['cli'] }); this.server.create('keyword', { keyword: 'not-cli' }); diff --git a/tests/mirage/summary-test.js b/tests/mirage/summary-test.js index 178a73d5c89..e8cfd6327df 100644 --- a/tests/mirage/summary-test.js +++ b/tests/mirage/summary-test.js @@ -4,12 +4,12 @@ import { module, test } from 'qunit'; import setupMirage from '../helpers/setup-mirage'; import fetch from 'fetch'; -module('Mirage | Summary', function(hooks) { +module('Mirage | Summary', function (hooks) { setupTest(hooks); setupMirage(hooks); - module('GET /api/v1/summary', function() { - test('empty case', async function(assert) { + module('GET /api/v1/summary', function () { + test('empty case', async function (assert) { let response = await fetch('/api/v1/summary'); assert.equal(response.status, 200); @@ -26,7 +26,7 @@ module('Mirage | Summary', function(hooks) { }); }); - test('returns the data for the front page', async function(assert) { + test('returns the data for the front page', async function (assert) { this.server.createList('category', 15); this.server.createList('keyword', 25); let crates = this.server.createList('crate', 20); diff --git a/tests/mirage/teams-test.js b/tests/mirage/teams-test.js index c9fe4399300..a2efb135fd2 100644 --- a/tests/mirage/teams-test.js +++ b/tests/mirage/teams-test.js @@ -4,12 +4,12 @@ import { module, test } from 'qunit'; import setupMirage from '../helpers/setup-mirage'; import fetch from 'fetch'; -module('Mirage | Teams', function(hooks) { +module('Mirage | Teams', function (hooks) { setupTest(hooks); setupMirage(hooks); - module('GET /api/v1/teams/:id', function() { - test('returns 404 for unknown teams', async function(assert) { + module('GET /api/v1/teams/:id', function () { + test('returns 404 for unknown teams', async function (assert) { let response = await fetch('/api/v1/teams/foo'); assert.equal(response.status, 404); @@ -17,7 +17,7 @@ module('Mirage | Teams', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns a team object for known teams', async function(assert) { + test('returns a team object for known teams', async function (assert) { let team = this.server.create('team', { name: 'maintainers' }); let response = await fetch(`/api/v1/teams/${team.login}`); diff --git a/tests/mirage/users-test.js b/tests/mirage/users-test.js index 8766a5c98a3..7bc36129e72 100644 --- a/tests/mirage/users-test.js +++ b/tests/mirage/users-test.js @@ -4,12 +4,12 @@ import { module, test } from 'qunit'; import setupMirage from '../helpers/setup-mirage'; import fetch from 'fetch'; -module('Mirage | Users', function(hooks) { +module('Mirage | Users', function (hooks) { setupTest(hooks); setupMirage(hooks); - module('GET /api/v1/users/:id', function() { - test('returns 404 for unknown users', async function(assert) { + module('GET /api/v1/users/:id', function () { + test('returns 404 for unknown users', async function (assert) { let response = await fetch('/api/v1/users/foo'); assert.equal(response.status, 404); @@ -17,7 +17,7 @@ module('Mirage | Users', function(hooks) { assert.deepEqual(responsePayload, { errors: [{ detail: 'Not Found' }] }); }); - test('returns a user object for known users', async function(assert) { + test('returns a user object for known users', async function (assert) { let user = this.server.create('user', { name: 'John Doe' }); let response = await fetch(`/api/v1/users/${user.login}`); diff --git a/tests/models/crate-test.js b/tests/models/crate-test.js index c22ef2826fb..ccdc960db89 100644 --- a/tests/models/crate-test.js +++ b/tests/models/crate-test.js @@ -5,16 +5,16 @@ import AdapterError from '@ember-data/adapter/error'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -module('Model | Crate', function(hooks) { +module('Model | Crate', function (hooks) { setupTest(hooks); setupMirage(hooks); - hooks.beforeEach(function() { + hooks.beforeEach(function () { this.store = this.owner.lookup('service:store'); }); - module('inviteOwner()', function() { - test('happy path', async function(assert) { + module('inviteOwner()', function () { + test('happy path', async function (assert) { let user = this.server.create('user'); let crate = this.server.create('crate'); @@ -26,21 +26,21 @@ module('Model | Crate', function(hooks) { assert.deepEqual(result, { ok: true }); }); - test('error handling', async function(assert) { + test('error handling', async function (assert) { let crate = this.server.create('crate'); this.server.create('version', { crate }); let crateRecord = await this.store.findRecord('crate', crate.id); - await assert.rejects(crateRecord.inviteOwner('unknown'), function(error) { + await assert.rejects(crateRecord.inviteOwner('unknown'), function (error) { assert.deepEqual(error.errors, [{ detail: 'Not Found' }]); return error instanceof AdapterError; }); }); }); - module('removeOwner()', function() { - test('happy path', async function(assert) { + module('removeOwner()', function () { + test('happy path', async function (assert) { let user = this.server.create('user'); let crate = this.server.create('crate'); @@ -52,13 +52,13 @@ module('Model | Crate', function(hooks) { assert.deepEqual(result, {}); }); - test('error handling', async function(assert) { + test('error handling', async function (assert) { let crate = this.server.create('crate'); this.server.create('version', { crate }); let crateRecord = await this.store.findRecord('crate', crate.id); - await assert.rejects(crateRecord.removeOwner('unknown'), function(error) { + await assert.rejects(crateRecord.removeOwner('unknown'), function (error) { assert.deepEqual(error.errors, [{ detail: 'Not Found' }]); return error instanceof AdapterError; }); diff --git a/tests/modifiers/highlight-syntax-test.js b/tests/modifiers/highlight-syntax-test.js index a023154c2a9..f04b2d7001a 100644 --- a/tests/modifiers/highlight-syntax-test.js +++ b/tests/modifiers/highlight-syntax-test.js @@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; -module('Modifier | highlight-syntax', function(hooks) { +module('Modifier | highlight-syntax', function (hooks) { setupRenderingTest(hooks); - test('uses Prism.js to apply syntax highlighting', async function(assert) { + test('uses Prism.js to apply syntax highlighting', async function (assert) { await render(hbs`
 #[macro_use]
@@ -17,7 +17,7 @@ extern crate bitflags;
     assert.dom('.keyword').exists({ count: 2 });
   });
 
-  test('accepts a `selector` argument', async function(assert) {
+  test('accepts a `selector` argument', async function (assert) {
     await render(hbs`
       
diff --git a/tests/services/redirector-test.js b/tests/services/redirector-test.js
index 80b7e3e94a1..9ffb5a2d353 100644
--- a/tests/services/redirector-test.js
+++ b/tests/services/redirector-test.js
@@ -4,11 +4,11 @@ import window, { setupWindowMock } from 'ember-window-mock';
 
 const URL = 'https://turbo.fish/';
 
-module('Service | Redirector', function(hooks) {
+module('Service | Redirector', function (hooks) {
   setupTest(hooks);
   setupWindowMock(hooks);
 
-  test('redirectTo() sets `window.location`', function(assert) {
+  test('redirectTo() sets `window.location`', function (assert) {
     assert.notEqual(window.location.href, URL);
 
     let redirector = this.owner.lookup('service:redirector');
diff --git a/tests/unit/controllers/crate/version-test.js b/tests/unit/controllers/crate/version-test.js
index dae6d1b7f5b..eb6bc7c7e5b 100644
--- a/tests/unit/controllers/crate/version-test.js
+++ b/tests/unit/controllers/crate/version-test.js
@@ -3,19 +3,19 @@ import { setupTest } from 'ember-qunit';
 import { A } from '@ember/array';
 import Service from '@ember/service';
 
-module('Unit | Controller | crate/version', function(hooks) {
+module('Unit | Controller | crate/version', function (hooks) {
   setupTest(hooks);
   const userId = 1;
   // stub the session service
   // https://guides.emberjs.com/release/testing/testing-components/#toc_stubbing-services
   const sessionStub = Service.extend();
 
-  hooks.beforeEach(function() {
+  hooks.beforeEach(function () {
     sessionStub.currentUser = { id: userId };
     this.owner.register('service:session', sessionStub);
   });
 
-  test('notYankedOrIsOwner is true when conditions fulfilled', function(assert) {
+  test('notYankedOrIsOwner is true when conditions fulfilled', function (assert) {
     assert.expect(2);
     let controller = this.owner.lookup('controller:crate/version');
     controller.model = { yanked: false };
@@ -24,7 +24,7 @@ module('Unit | Controller | crate/version', function(hooks) {
     assert.ok(controller.notYankedOrIsOwner);
   });
 
-  test('notYankedOrIsOwner is false when conditions fulfilled', function(assert) {
+  test('notYankedOrIsOwner is false when conditions fulfilled', function (assert) {
     assert.expect(2);
     let controller = this.owner.lookup('controller:crate/version');
     controller.model = { yanked: true };
diff --git a/tests/unit/helpers/format-crate-size-test.js b/tests/unit/helpers/format-crate-size-test.js
index b244ed488aa..eb93c2f6997 100644
--- a/tests/unit/helpers/format-crate-size-test.js
+++ b/tests/unit/helpers/format-crate-size-test.js
@@ -1,20 +1,20 @@
 import { formatCrateSize } from '../../../helpers/format-crate-size';
 import { module, test } from 'qunit';
 
-module('Unit | Helper | format-crate-size', function() {
-  test('Small crate size formats in kB', function(assert) {
+module('Unit | Helper | format-crate-size', function () {
+  test('Small crate size formats in kB', function (assert) {
     assert.equal(formatCrateSize(531), '0.53 kB');
   });
 
-  test('Small crate size formats in kB without trailing 0', function(assert) {
+  test('Small crate size formats in kB without trailing 0', function (assert) {
     assert.equal(formatCrateSize(90000), '90 kB');
   });
 
-  test('Large crate size formats in MB', function(assert) {
+  test('Large crate size formats in MB', function (assert) {
     assert.equal(formatCrateSize(912345), '0.91 MB');
   });
 
-  test('Large crate size formats in MB without trailing 0', function(assert) {
+  test('Large crate size formats in MB without trailing 0', function (assert) {
     assert.equal(formatCrateSize(9100000), '9.1 MB');
   });
 });
diff --git a/tests/unit/helpers/format-email-test.js b/tests/unit/helpers/format-email-test.js
index 20ab0b0eac3..87396bbd5ca 100644
--- a/tests/unit/helpers/format-email-test.js
+++ b/tests/unit/helpers/format-email-test.js
@@ -1,9 +1,9 @@
 import { formatEmail } from '../../../helpers/format-email';
 import { module, test } from 'qunit';
 
-module('Unit | Helper | format-email', function() {
+module('Unit | Helper | format-email', function () {
   // Replace this with your real tests.
-  test('it works', function(assert) {
+  test('it works', function (assert) {
     assert.equal(formatEmail('foo'), 'foo');
     assert.equal(formatEmail('foo ').toString(), `foo`);
     assert.equal(
diff --git a/tests/unit/helpers/format-num-test.js b/tests/unit/helpers/format-num-test.js
index ac6aa37b58d..14a5de7efd2 100644
--- a/tests/unit/helpers/format-num-test.js
+++ b/tests/unit/helpers/format-num-test.js
@@ -1,8 +1,8 @@
 import { formatNum } from '../../../helpers/format-num';
 import { module, test } from 'qunit';
 
-module('Unit | Helper | format-num', function() {
-  test('it works', function(assert) {
+module('Unit | Helper | format-num', function () {
+  test('it works', function (assert) {
     assert.equal(formatNum(42), '42');
     assert.equal(formatNum(0), '0');
     assert.equal(formatNum(1000), '1,000');
diff --git a/tests/unit/mixins/pagination-test.js b/tests/unit/mixins/pagination-test.js
index e172efbc63a..9013b4771c9 100644
--- a/tests/unit/mixins/pagination-test.js
+++ b/tests/unit/mixins/pagination-test.js
@@ -3,9 +3,9 @@ import { module, test } from 'qunit';
 
 import PaginationMixin from '../../../mixins/pagination';
 
-module('Unit | Mixin | pagination', function() {
+module('Unit | Mixin | pagination', function () {
   // Replace this with your real tests.
-  test('it works', function(assert) {
+  test('it works', function (assert) {
     // eslint-disable-next-line ember/no-new-mixins
     let PaginationObject = EmberObject.extend(PaginationMixin);
     let subject = PaginationObject.create();