// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`#users.activate should activate a suspended user 1`] = `
Object {
  "data": Object {
    "avatarUrl": "http://example.com/avatar.png",
    "createdAt": "2018-01-01T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": false,
    "name": "User 1",
  },
  "ok": true,
  "status": 200,
}
`;

exports[`#users.activate should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.delete should require authentication 1`] = `
Object {
  "error": "authentication_required",
  "message": "Authentication required",
  "ok": false,
  "status": 401,
}
`;

exports[`#users.demote should demote an admin 1`] = `
Object {
  "data": Object {
    "avatarUrl": "http://example.com/avatar.png",
    "createdAt": "2018-01-01T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": false,
    "name": "User 1",
  },
  "ok": true,
  "status": 200,
}
`;

exports[`#users.demote should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.demote shouldn't demote admins if only one available  1`] = `
Object {
  "error": "validation_error",
  "message": "At least one admin is required",
  "ok": false,
  "status": 400,
}
`;

exports[`#users.list should require admin for detailed info 1`] = `
Object {
  "data": Array [
    Object {
      "avatarUrl": "http://example.com/avatar.png",
      "createdAt": "2018-01-01T00:00:00.000Z",
      "id": "fa952cff-fa64-4d42-a6ea-6955c9689046",
      "isAdmin": true,
      "isSuspended": false,
      "name": "Admin User",
    },
    Object {
      "avatarUrl": "http://example.com/avatar.png",
      "createdAt": "2018-01-01T00:00:00.000Z",
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
      "isAdmin": false,
      "isSuspended": false,
      "name": "User 1",
    },
  ],
  "ok": true,
  "pagination": Object {
    "limit": 15,
    "nextPath": "/api/users.list?limit=15&offset=15",
    "offset": 0,
  },
  "status": 200,
}
`;

exports[`#users.list should return teams paginated user list 1`] = `
Object {
  "data": Array [
    Object {
      "avatarUrl": "http://example.com/avatar.png",
      "createdAt": "2018-01-01T00:00:00.000Z",
      "email": "user1@example.com",
      "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
      "isAdmin": false,
      "isSuspended": false,
      "name": "User 1",
    },
    Object {
      "avatarUrl": "http://example.com/avatar.png",
      "createdAt": "2018-01-01T00:00:00.000Z",
      "email": "admin@example.com",
      "id": "fa952cff-fa64-4d42-a6ea-6955c9689046",
      "isAdmin": true,
      "isSuspended": false,
      "name": "Admin User",
    },
  ],
  "ok": true,
  "pagination": Object {
    "limit": 15,
    "nextPath": "/api/users.list?limit=15&offset=15",
    "offset": 0,
  },
  "status": 200,
}
`;

exports[`#users.promote should promote a new admin 1`] = `
Object {
  "data": Object {
    "avatarUrl": "http://example.com/avatar.png",
    "createdAt": "2018-01-01T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": true,
    "isSuspended": false,
    "name": "User 1",
  },
  "ok": true,
  "status": 200,
}
`;

exports[`#users.promote should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.suspend should require admin 1`] = `
Object {
  "error": "admin_required",
  "message": "An admin role is required to access this resource",
  "ok": false,
  "status": 403,
}
`;

exports[`#users.suspend should suspend an user 1`] = `
Object {
  "data": Object {
    "avatarUrl": "http://example.com/avatar.png",
    "createdAt": "2018-01-01T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": true,
    "name": "User 1",
  },
  "ok": true,
  "status": 200,
}
`;

exports[`#users.suspend shouldn't allow suspending the user themselves 1`] = `
Object {
  "error": "validation_error",
  "message": "Unable to suspend the current user",
  "ok": false,
  "status": 400,
}
`;

exports[`#users.update should require authentication 1`] = `
Object {
  "error": "authentication_required",
  "message": "Authentication required",
  "ok": false,
  "status": 401,
}
`;

exports[`#users.update should update user profile information 1`] = `
Object {
  "data": Object {
    "avatarUrl": "http://example.com/avatar.png",
    "createdAt": "2018-01-01T00:00:00.000Z",
    "email": "user1@example.com",
    "id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
    "isAdmin": false,
    "isSuspended": false,
    "name": "New name",
  },
  "ok": true,
  "status": 200,
}
`;
