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'