-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make mongo optional in pre-mod filter so tests can run
- Loading branch information
Showing
2 changed files
with
69 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 67 additions & 67 deletions
134
server/src/core/server/services/users/user.emailPremodFilter.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,81 @@ | ||
// import { | ||
// createTenantFixture, | ||
// createUserFixture, | ||
// } from "coral-server/test/fixtures"; | ||
import { | ||
createTenantFixture, | ||
createUserFixture, | ||
} from "coral-server/test/fixtures"; | ||
|
||
// import { | ||
// EMAIL_PREMOD_FILTER_PERIOD_LIMIT, | ||
// shouldPremodDueToLikelySpamEmail, | ||
// } from "./emailPremodFilter"; | ||
import { | ||
EMAIL_PREMOD_FILTER_PERIOD_LIMIT, | ||
shouldPremodDueToLikelySpamEmail, | ||
} from "./emailPremodFilter"; | ||
|
||
// const tooManyPeriodsEmail = "[email protected]"; | ||
// const justEnoughPeriodsEmail = "[email protected]"; | ||
// const noPeriodsEmail = "[email protected]"; | ||
const tooManyPeriodsEmail = "[email protected]"; | ||
const justEnoughPeriodsEmail = "[email protected]"; | ||
const noPeriodsEmail = "[email protected]"; | ||
|
||
// it("does not premod filter emails when feature is disabled", () => { | ||
// const tenant = createTenantFixture({ | ||
// premoderateEmailAddress: { | ||
// tooManyPeriods: { | ||
// enabled: false, | ||
// }, | ||
// }, | ||
// }); | ||
it("does not premod filter emails when feature is disabled", () => { | ||
const tenant = createTenantFixture({ | ||
premoderateEmailAddress: { | ||
tooManyPeriods: { | ||
enabled: false, | ||
}, | ||
}, | ||
}); | ||
|
||
// const user = createUserFixture({ | ||
// email: tooManyPeriodsEmail, | ||
// }); | ||
const user = createUserFixture({ | ||
email: tooManyPeriodsEmail, | ||
}); | ||
|
||
// const result = shouldPremodDueToLikelySpamEmail(tenant, user); | ||
// expect(!result); | ||
// }); | ||
const result = shouldPremodDueToLikelySpamEmail(undefined, tenant, user); | ||
expect(!result); | ||
}); | ||
|
||
// it(`does not premod filter emails when feature enabled and has less than ${EMAIL_PREMOD_FILTER_PERIOD_LIMIT} periods`, () => { | ||
// const tenant = createTenantFixture({ | ||
// premoderateEmailAddress: { | ||
// tooManyPeriods: { | ||
// enabled: true, | ||
// }, | ||
// }, | ||
// }); | ||
it(`does not premod filter emails when feature enabled and has less than ${EMAIL_PREMOD_FILTER_PERIOD_LIMIT} periods`, () => { | ||
const tenant = createTenantFixture({ | ||
premoderateEmailAddress: { | ||
tooManyPeriods: { | ||
enabled: true, | ||
}, | ||
}, | ||
}); | ||
|
||
// const user = createUserFixture({ | ||
// email: justEnoughPeriodsEmail, | ||
// }); | ||
const user = createUserFixture({ | ||
email: justEnoughPeriodsEmail, | ||
}); | ||
|
||
// const result = shouldPremodDueToLikelySpamEmail(tenant, user); | ||
// expect(result); | ||
// }); | ||
const result = shouldPremodDueToLikelySpamEmail(undefined, tenant, user); | ||
expect(result); | ||
}); | ||
|
||
// it(`does not premod filter emails when feature enabled and has no periods`, () => { | ||
// const tenant = createTenantFixture({ | ||
// premoderateEmailAddress: { | ||
// tooManyPeriods: { | ||
// enabled: true, | ||
// }, | ||
// }, | ||
// }); | ||
it(`does not premod filter emails when feature enabled and has no periods`, () => { | ||
const tenant = createTenantFixture({ | ||
premoderateEmailAddress: { | ||
tooManyPeriods: { | ||
enabled: true, | ||
}, | ||
}, | ||
}); | ||
|
||
// const user = createUserFixture({ | ||
// email: noPeriodsEmail, | ||
// }); | ||
const user = createUserFixture({ | ||
email: noPeriodsEmail, | ||
}); | ||
|
||
// const result = shouldPremodDueToLikelySpamEmail(tenant, user); | ||
// expect(result); | ||
// }); | ||
const result = shouldPremodDueToLikelySpamEmail(undefined, tenant, user); | ||
expect(result); | ||
}); | ||
|
||
// it(`does premod filter emails when feature is enabled and has too many (${EMAIL_PREMOD_FILTER_PERIOD_LIMIT} or more) periods`, () => { | ||
// const tenant = createTenantFixture({ | ||
// premoderateEmailAddress: { | ||
// tooManyPeriods: { | ||
// enabled: true, | ||
// }, | ||
// }, | ||
// }); | ||
it(`does premod filter emails when feature is enabled and has too many (${EMAIL_PREMOD_FILTER_PERIOD_LIMIT} or more) periods`, () => { | ||
const tenant = createTenantFixture({ | ||
premoderateEmailAddress: { | ||
tooManyPeriods: { | ||
enabled: true, | ||
}, | ||
}, | ||
}); | ||
|
||
// const user = createUserFixture({ | ||
// email: tooManyPeriodsEmail, | ||
// }); | ||
const user = createUserFixture({ | ||
email: tooManyPeriodsEmail, | ||
}); | ||
|
||
// const result = shouldPremodDueToLikelySpamEmail(tenant, user); | ||
// expect(result); | ||
// }); | ||
const result = shouldPremodDueToLikelySpamEmail(undefined, tenant, user); | ||
expect(result); | ||
}); |