(core) move apiserver tests to core, disentangling notifier+billing parts

Summary:
This moves some more tests to core that would be useful for ANCT,
which had been stuck in grist-saas due to some entanglements with
sendgrid and billing. For sendgrid, I've moved around just enough
material to permit the tests to run mostly unchanged. Ideally
the interface to a notification system would be generalized, but
that's a bigger project.

Test Plan:
checked that tests are likely to run as expected
in core using preview laid out by ./buildtools/build_core.sh

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4149
This commit is contained in:
Paul Fitzpatrick
2023-12-26 08:41:19 -05:00
parent 7e57b8c7a7
commit 145138b7e9
11 changed files with 5210 additions and 1 deletions

View File

@@ -97,6 +97,7 @@ export function makeSimpleCreator(opts: {
return notifier?.create(dbManager, gristConfig) ?? {
get testPending() { return false; },
async deleteUser() { /* do nothing */ },
testSetSendMessageCallback() { return undefined; },
};
},
ExternalStorage(purpose, extraPrefix) {

View File

@@ -1,6 +1,12 @@
import {SendGridConfig, SendGridMail} from 'app/gen-server/lib/NotifierTypes';
export interface INotifier {
// for test purposes, check if any notifications are in progress
readonly testPending: boolean;
deleteUser(userId: number): Promise<void>;
// Intercept outgoing messages for test purposes.
// Return undefined if no notification system is available.
testSetSendMessageCallback(op: (body: SendGridMail, description: string) => Promise<void>): SendGridConfig|undefined;
}