Restore the userCreated event

This commit is contained in:
Wyatt Johnson
2018-03-12 16:39:38 -06:00
parent 2f5fc03e9c
commit f826db1edf
22 changed files with 176 additions and 120 deletions
@@ -11,7 +11,9 @@ describe('graph.mutations.changeUsername', () => {
let user;
beforeEach(async () => {
await SettingsService.init();
const ctx = Context.forSystem();
user = await UsersService.createLocalUser(
ctx,
'test@test.com',
'testpassword1!',
'kirk'
@@ -16,8 +16,10 @@ describe('graph.mutations.editComment', () => {
beforeEach(async () => {
timekeeper.reset();
await SettingsService.init();
const ctx = Context.forSystem();
asset = await AssetModel.create({});
user = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'
@@ -124,7 +126,9 @@ describe('graph.mutations.editComment', () => {
body: `hello there! ${String(Math.random()).slice(2)}`,
});
const ctx = Context.forSystem();
const userB = await UsersService.createLocalUser(
ctx,
'usernameB@example.com',
'password',
'usernameB'
@@ -34,12 +34,15 @@ describe('graph.mutations.ignoreUser', () => {
});
it('users can ignoreUser', async () => {
const ctx = Context.forSystem();
let currentUser = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'
);
const userToIgnore = await UsersService.createLocalUser(
ctx,
'usernameB@example.com',
'password',
'usernameB'
@@ -83,7 +86,9 @@ describe('graph.mutations.ignoreUser', () => {
});
it('users cannot ignore themselves', async () => {
const ctx = Context.forSystem();
const user = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'
@@ -124,18 +129,22 @@ describe('graph.mutations.stopIgnoringUser', () => {
// We're going to ignore 2 users,
// then stopIgnoring 1 of them
// then assert myIgnoredUsers only lists the one remaining
const ctx = Context.forSystem();
let currentUser = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'
);
const usersToIgnore = await Promise.all([
UsersService.createLocalUser(
ctx,
'usernameB@example.com',
'password',
'usernameB'
),
UsersService.createLocalUser(
ctx,
'usernameC@example.com',
'password',
'usernameC'
@@ -17,7 +17,9 @@ describe('graph.mutations.banUser', () => {
beforeEach(async () => {
await SettingsService.init();
const ctx = Context.forSystem();
user = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'
@@ -19,7 +19,9 @@ describe('graph.mutations.suspendUser', () => {
beforeEach(async () => {
await SettingsService.init();
const ctx = Context.forSystem();
user = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'
@@ -19,7 +19,9 @@ const { expect } = chai;
beforeEach(async () => {
await SettingsService.init();
const ctx = Context.forSystem();
user = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'
+22 -17
View File
@@ -17,23 +17,28 @@ describe('graph.queries.asset', () => {
{ id: '1', url: 'https://example.com/?id=1' },
{ id: '2', url: 'https://example.com/?id=2' },
]);
users = await UsersService.createLocalUsers([
{
email: 'usernameA@example.com',
password: 'password',
username: 'usernameA',
},
{
email: 'usernameB@example.com',
password: 'password',
username: 'usernameB',
},
{
email: 'usernameC@example.com',
password: 'password',
username: 'usernameC',
},
]);
const ctx = Context.forSystem();
users = await Promise.all(
[
{
email: 'usernameA@example.com',
password: 'password',
username: 'usernameA',
},
{
email: 'usernameB@example.com',
password: 'password',
username: 'usernameB',
},
{
email: 'usernameC@example.com',
password: 'password',
username: 'usernameC',
},
].map(({ email, username, password }) =>
UsersService.createLocalUser(ctx, email, password, username)
)
);
comments = await Promise.all(
[0, 0, 1, 1].map(idx =>
CommentsService.publicCreate({
+2 -1
View File
@@ -14,8 +14,9 @@ describe('graph.queries.user', () => {
let user;
beforeEach(async () => {
await SettingsService.init();
const ctx = Context.forSystem();
user = await UsersService.createLocalUser(
ctx,
'usernameA@example.com',
'password',
'usernameA'