Use single quotes :P
This commit is contained in:
@ -1,22 +1,22 @@
|
||||
const request = require("supertest");
|
||||
const request = require('supertest');
|
||||
|
||||
const createServer = require("../createServer");
|
||||
const clearBlacklist = require("./utils/clearBlacklist");
|
||||
const withToken = require("./utils/withToken");
|
||||
const createServer = require('../createServer');
|
||||
const clearBlacklist = require('./utils/clearBlacklist');
|
||||
const withToken = require('./utils/withToken');
|
||||
|
||||
describe("The /_blacklist endpoint", () => {
|
||||
describe('The /_blacklist endpoint', () => {
|
||||
let server;
|
||||
beforeEach(() => {
|
||||
server = createServer();
|
||||
});
|
||||
|
||||
describe("POST /_blacklist", () => {
|
||||
describe('POST /_blacklist', () => {
|
||||
afterEach(clearBlacklist);
|
||||
|
||||
describe("with no auth", () => {
|
||||
it("is forbidden", done => {
|
||||
describe('with no auth', () => {
|
||||
it('is forbidden', done => {
|
||||
request(server)
|
||||
.post("/_blacklist")
|
||||
.post('/_blacklist')
|
||||
.end((err, res) => {
|
||||
expect(res.statusCode).toBe(403);
|
||||
done();
|
||||
@ -25,11 +25,11 @@ describe("The /_blacklist endpoint", () => {
|
||||
});
|
||||
|
||||
describe('with the "blacklist.add" scope', () => {
|
||||
it("can add to the blacklist", done => {
|
||||
it('can add to the blacklist', done => {
|
||||
withToken({ blacklist: { add: true } }, token => {
|
||||
request(server)
|
||||
.post("/_blacklist")
|
||||
.send({ token, packageName: "bad-package" })
|
||||
.post('/_blacklist')
|
||||
.send({ token, packageName: 'bad-package' })
|
||||
.end((err, res) => {
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.body.ok).toBe(true);
|
||||
@ -40,11 +40,11 @@ describe("The /_blacklist endpoint", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /_blacklist", () => {
|
||||
describe("with no auth", () => {
|
||||
it("is forbidden", done => {
|
||||
describe('GET /_blacklist', () => {
|
||||
describe('with no auth', () => {
|
||||
it('is forbidden', done => {
|
||||
request(server)
|
||||
.get("/_blacklist")
|
||||
.get('/_blacklist')
|
||||
.end((err, res) => {
|
||||
expect(res.statusCode).toBe(403);
|
||||
done();
|
||||
@ -53,10 +53,10 @@ describe("The /_blacklist endpoint", () => {
|
||||
});
|
||||
|
||||
describe('with the "blacklist.read" scope', () => {
|
||||
it("can read the blacklist", done => {
|
||||
it('can read the blacklist', done => {
|
||||
withToken({ blacklist: { read: true } }, token => {
|
||||
request(server)
|
||||
.get("/_blacklist?token=" + token)
|
||||
.get('/_blacklist?token=' + token)
|
||||
.end((err, res) => {
|
||||
expect(res.statusCode).toBe(200);
|
||||
done();
|
||||
@ -66,11 +66,11 @@ describe("The /_blacklist endpoint", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("DELETE /_blacklist/:packageName", () => {
|
||||
describe("with no auth", () => {
|
||||
it("is forbidden", done => {
|
||||
describe('DELETE /_blacklist/:packageName', () => {
|
||||
describe('with no auth', () => {
|
||||
it('is forbidden', done => {
|
||||
request(server)
|
||||
.delete("/_blacklist/bad-package")
|
||||
.delete('/_blacklist/bad-package')
|
||||
.end((err, res) => {
|
||||
expect(res.statusCode).toBe(403);
|
||||
done();
|
||||
@ -79,10 +79,10 @@ describe("The /_blacklist endpoint", () => {
|
||||
});
|
||||
|
||||
describe('with the "blacklist.remove" scope', () => {
|
||||
it("can remove a package from the blacklist", done => {
|
||||
it('can remove a package from the blacklist', done => {
|
||||
withToken({ blacklist: { remove: true } }, token => {
|
||||
request(server)
|
||||
.delete("/_blacklist/bad-package")
|
||||
.delete('/_blacklist/bad-package')
|
||||
.send({ token })
|
||||
.end((err, res) => {
|
||||
expect(res.statusCode).toBe(200);
|
||||
@ -92,10 +92,10 @@ describe("The /_blacklist endpoint", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("can remove a scoped package from the blacklist", done => {
|
||||
it('can remove a scoped package from the blacklist', done => {
|
||||
withToken({ blacklist: { remove: true } }, token => {
|
||||
request(server)
|
||||
.delete("/_blacklist/@scope/bad-package")
|
||||
.delete('/_blacklist/@scope/bad-package')
|
||||
.send({ token })
|
||||
.end((err, res) => {
|
||||
expect(res.statusCode).toBe(200);
|
||||
|
Reference in New Issue
Block a user