This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/server/api/__snapshots__/users.test.js.snap

216 lines
5.0 KiB
Plaintext
Raw Normal View History

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`#users.activate should activate a suspended user 1`] = `
2018-03-04 23:38:51 +00:00
Object {
"data": Object {
"avatarUrl": "http://example.com/avatar.png",
"createdAt": "2018-01-02T00:00:00.000Z",
2018-03-04 23:38:51 +00:00
"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`] = `
2018-03-04 23:38:51 +00:00
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`] = `
2018-07-07 22:38:22 +00:00
Object {
"error": "authentication_required",
"message": "Authentication required",
"ok": false,
"status": 401,
}
`;
exports[`#users.demote should demote an admin 1`] = `
2018-03-04 23:38:51 +00:00
Object {
"data": Object {
"avatarUrl": "http://example.com/avatar.png",
"createdAt": "2018-01-02T00:00:00.000Z",
2018-03-04 23:38:51 +00:00
"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`] = `
2018-03-04 23:38:51 +00:00
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`] = `
2018-03-04 23:38:51 +00:00
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-02T00:00:00.000Z",
"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",
"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.list should return teams paginated user list 1`] = `
Object {
"data": Array [
Object {
"avatarUrl": "http://example.com/avatar.png",
"createdAt": "2018-01-02T00: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`] = `
2018-03-04 23:38:51 +00:00
Object {
"data": Object {
"avatarUrl": "http://example.com/avatar.png",
"createdAt": "2018-01-02T00:00:00.000Z",
2018-03-04 23:38:51 +00:00
"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`] = `
2018-03-04 23:38:51 +00:00
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`] = `
2018-03-04 23:38:51 +00:00
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`] = `
2018-03-04 23:38:51 +00:00
Object {
"data": Object {
"avatarUrl": "http://example.com/avatar.png",
"createdAt": "2018-01-02T00:00:00.000Z",
2018-03-04 23:38:51 +00:00
"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`] = `
2018-03-04 23:38:51 +00:00
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-02T00:00:00.000Z",
2018-06-01 04:01:06 +00:00
"email": "user1@example.com",
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
2018-06-01 04:01:06 +00:00
"isAdmin": false,
"isSuspended": false,
"name": "New name",
},
"ok": true,
"status": 200,
}
`;