@marcoappio/marco-config 2.0.504 → 2.0.506
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schemas/auth.d.ts +1 -1
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/string.d.ts +1 -1
- package/dist/schemas/string.d.ts.map +1 -1
- package/dist/schemas/string.js +4 -1
- package/dist/sdk/endpoints/index.d.ts +4 -4
- package/dist/sdk/endpoints/public/auth/index.d.ts +4 -4
- package/dist/sdk/endpoints/public/auth/refreshAuth.d.ts +1 -1
- package/dist/sdk/endpoints/public/auth/sendAuthCode.d.ts +1 -1
- package/dist/sdk/endpoints/public/auth/verifyAuthCode.d.ts +2 -2
- package/dist/sdk/endpoints/public/index.d.ts +4 -4
- package/dist/sdk/index.d.ts +4 -4
- package/dist/types/AuthData.d.ts +4 -0
- package/dist/types/AuthData.d.ts.map +1 -0
- package/dist/types/AuthData.js +1 -0
- package/dist/types/IMAPSourceLocation.d.ts +7 -0
- package/dist/types/IMAPSourceLocation.d.ts.map +1 -0
- package/dist/types/IMAPSourceLocation.js +1 -0
- package/dist/types/Zero.d.ts +14 -8
- package/dist/types/Zero.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/zero/index.d.ts +7749 -3113
- package/dist/zero/index.d.ts.map +1 -1
- package/dist/zero/index.js +14 -5
- package/dist/zero/mutatorSchemas/account.d.ts +80 -0
- package/dist/zero/mutatorSchemas/account.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/account.js +66 -0
- package/dist/zero/mutatorSchemas/draft.d.ts +150 -0
- package/dist/zero/mutatorSchemas/draft.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/draft.js +104 -0
- package/dist/zero/mutatorSchemas/index.d.ts +323 -0
- package/dist/zero/mutatorSchemas/index.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/index.js +10 -0
- package/dist/zero/mutatorSchemas/thread.d.ts +71 -0
- package/dist/zero/mutatorSchemas/thread.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/thread.js +47 -0
- package/dist/zero/mutatorSchemas/user.d.ts +26 -0
- package/dist/zero/mutatorSchemas/user.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/user.js +27 -0
- package/dist/zero/mutators/accountMutators/accountMutators.d.ts +3 -188
- package/dist/zero/mutators/accountMutators/accountMutators.d.ts.map +1 -1
- package/dist/zero/mutators/accountMutators/accountMutators.js +82 -118
- package/dist/zero/mutators/accountMutators/accountMutators.test.d.ts +2 -0
- package/dist/zero/mutators/accountMutators/accountMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/accountMutators/accountMutators.test.js +372 -0
- package/dist/zero/mutators/accountMutators/index.d.ts +1 -1
- package/dist/zero/mutators/accountMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/accountMutators/index.js +1 -1
- package/dist/zero/mutators/draftMutators/draftMutators.d.ts +3 -305
- package/dist/zero/mutators/draftMutators/draftMutators.d.ts.map +1 -1
- package/dist/zero/mutators/draftMutators/draftMutators.js +83 -157
- package/dist/zero/mutators/draftMutators/draftMutators.test.d.ts +2 -0
- package/dist/zero/mutators/draftMutators/draftMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/draftMutators/draftMutators.test.js +416 -0
- package/dist/zero/mutators/draftMutators/index.d.ts +1 -1
- package/dist/zero/mutators/draftMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/draftMutators/index.js +1 -1
- package/dist/zero/mutators/index.d.ts +1 -251
- package/dist/zero/mutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/index.js +1 -11
- package/dist/zero/mutators/mutators.d.ts +17 -1519
- package/dist/zero/mutators/mutators.d.ts.map +1 -1
- package/dist/zero/mutators/mutators.js +38 -11
- package/dist/zero/mutators/threadMutators/index.d.ts +1 -1
- package/dist/zero/mutators/threadMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/index.js +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts +6 -199
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.js +87 -119
- package/dist/zero/mutators/threadMutators/threadMutators.test.d.ts +2 -0
- package/dist/zero/mutators/threadMutators/threadMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/threadMutators/threadMutators.test.js +755 -0
- package/dist/zero/mutators/userMutators/index.d.ts +1 -1
- package/dist/zero/mutators/userMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/userMutators/index.js +1 -1
- package/dist/zero/mutators/userMutators/userMutators.d.ts +3 -56
- package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
- package/dist/zero/mutators/userMutators/userMutators.js +26 -40
- package/dist/zero/mutators/userMutators/userMutators.test.d.ts +2 -0
- package/dist/zero/mutators/userMutators/userMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/userMutators/userMutators.test.js +84 -0
- package/dist/zero/queries/getAccounts.d.ts +1025 -4
- package/dist/zero/queries/getAccounts.d.ts.map +1 -1
- package/dist/zero/queries/getAccounts.js +3 -6
- package/dist/zero/queries/getContacts.d.ts +1033 -18
- package/dist/zero/queries/getContacts.d.ts.map +1 -1
- package/dist/zero/queries/getContacts.js +15 -11
- package/dist/zero/queries/getDrafts.d.ts +1031 -11
- package/dist/zero/queries/getDrafts.d.ts.map +1 -1
- package/dist/zero/queries/getDrafts.js +11 -7
- package/dist/zero/queries/getThread.d.ts +1028 -7
- package/dist/zero/queries/getThread.d.ts.map +1 -1
- package/dist/zero/queries/getThread.js +9 -5
- package/dist/zero/queries/getThreadList.d.ts +1035 -23
- package/dist/zero/queries/getThreadList.d.ts.map +1 -1
- package/dist/zero/queries/getThreadList.js +18 -14
- package/dist/zero/queries/getThreads.d.ts +1035 -23
- package/dist/zero/queries/getThreads.d.ts.map +1 -1
- package/dist/zero/queries/getThreads.js +18 -14
- package/dist/zero/queries/getUser.d.ts +1025 -4
- package/dist/zero/queries/getUser.d.ts.map +1 -1
- package/dist/zero/queries/getUser.js +7 -10
- package/dist/zero/queries/index.d.ts +141 -460
- package/dist/zero/queries/index.d.ts.map +1 -1
- package/dist/zero/queries/index.js +10 -18
- package/dist/zero/schema.d.ts +133 -133
- package/dist/zero/schema.d.ts.map +1 -1
- package/dist/zero/schema.js +1 -0
- package/package.json +3 -2
- package/dist/zero/crud.d.ts +0 -1024
- package/dist/zero/crud.d.ts.map +0 -1
- package/dist/zero/crud.js +0 -3
- package/dist/zero/mutators/typedMutator.d.ts +0 -2056
- package/dist/zero/mutators/typedMutator.d.ts.map +0 -1
- package/dist/zero/mutators/typedMutator.js +0 -2
- package/dist/zero/queries/z.d.ts +0 -14439
- package/dist/zero/queries/z.d.ts.map +0 -1
- package/dist/zero/queries/z.js +0 -3
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { describe, expect, it, mock } from 'bun:test';
|
|
2
|
+
import { createMutators, ZeroMutatorValidationError } from '../mutators';
|
|
3
|
+
describe('accountMutators', () => {
|
|
4
|
+
describe('createAccount', () => {
|
|
5
|
+
it('creates an account', async () => {
|
|
6
|
+
const accountInsert = mock(async () => { });
|
|
7
|
+
const accountAliasInsert = mock(async () => { });
|
|
8
|
+
const mutators = createMutators({ sub: 'test-user-id' });
|
|
9
|
+
const payload = {
|
|
10
|
+
aliasId: 'test-alias-id-1',
|
|
11
|
+
color: '#ff0000',
|
|
12
|
+
emailAddress: 'user@example.com',
|
|
13
|
+
id: 'test-account-id-1',
|
|
14
|
+
};
|
|
15
|
+
const transaction = {
|
|
16
|
+
mutate: {
|
|
17
|
+
account: {
|
|
18
|
+
delete: mock(async () => { }),
|
|
19
|
+
insert: accountInsert,
|
|
20
|
+
update: mock(async () => { }),
|
|
21
|
+
},
|
|
22
|
+
accountAlias: {
|
|
23
|
+
delete: mock(async () => { }),
|
|
24
|
+
insert: accountAliasInsert,
|
|
25
|
+
update: mock(async () => { }),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
query: {},
|
|
29
|
+
};
|
|
30
|
+
await mutators.account.createAccount(transaction, payload);
|
|
31
|
+
expect(accountInsert).toHaveBeenCalledWith({
|
|
32
|
+
color: payload.color,
|
|
33
|
+
displayName: null,
|
|
34
|
+
id: payload.id,
|
|
35
|
+
imapConnectionStatus: 'AWAITING_CONNECTION',
|
|
36
|
+
mailProcessedCount: 0,
|
|
37
|
+
mailTotalCount: 0,
|
|
38
|
+
primaryAliasId: payload.aliasId,
|
|
39
|
+
userId: 'test-user-id',
|
|
40
|
+
});
|
|
41
|
+
expect(accountAliasInsert).toHaveBeenCalledWith({
|
|
42
|
+
accountId: payload.id,
|
|
43
|
+
emailAddress: payload.emailAddress,
|
|
44
|
+
id: payload.aliasId,
|
|
45
|
+
isPrimary: true,
|
|
46
|
+
name: null,
|
|
47
|
+
});
|
|
48
|
+
expect(accountInsert.mock.invocationCallOrder[0]).toBeLessThan(accountAliasInsert.mock.invocationCallOrder[0]);
|
|
49
|
+
});
|
|
50
|
+
it('throws ZeroMutatorValidationError on invalid payloads', async () => {
|
|
51
|
+
const mutators = createMutators({ sub: 'test-user-id' });
|
|
52
|
+
await expect(mutators.account.createAccount({
|
|
53
|
+
mutate: {},
|
|
54
|
+
query: {},
|
|
55
|
+
}, {
|
|
56
|
+
aliasId: 'test-alias-id-1',
|
|
57
|
+
color: 'blue',
|
|
58
|
+
emailAddress: 'invalid-email',
|
|
59
|
+
id: 'test-account-id-1',
|
|
60
|
+
})).rejects.toBeInstanceOf(ZeroMutatorValidationError);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('createAlias', () => {
|
|
64
|
+
it('creates an alias', async () => {
|
|
65
|
+
const accountAliasInsert = mock(async () => { });
|
|
66
|
+
const mutators = createMutators({ sub: 'test-user-id' });
|
|
67
|
+
const transaction = {
|
|
68
|
+
mutate: {
|
|
69
|
+
accountAlias: {
|
|
70
|
+
delete: mock(async () => { }),
|
|
71
|
+
insert: accountAliasInsert,
|
|
72
|
+
update: mock(async () => { }),
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
query: {},
|
|
76
|
+
};
|
|
77
|
+
await mutators.account.createAlias(transaction, {
|
|
78
|
+
accountId: 'test-account-id-1',
|
|
79
|
+
alias: {
|
|
80
|
+
emailAddress: 'alias@example.com',
|
|
81
|
+
id: 'test-alias-id-2',
|
|
82
|
+
name: 'Work Email',
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
expect(accountAliasInsert).toHaveBeenCalledWith({
|
|
86
|
+
accountId: 'test-account-id-1',
|
|
87
|
+
emailAddress: 'alias@example.com',
|
|
88
|
+
id: 'test-alias-id-2',
|
|
89
|
+
isPrimary: false,
|
|
90
|
+
name: 'Work Email',
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
describe('deleteAccount', () => {
|
|
95
|
+
it('deletes an account', async () => {
|
|
96
|
+
const accountDelete = mock(async () => { });
|
|
97
|
+
const mutators = createMutators({ sub: 'test-user-id' });
|
|
98
|
+
const transaction = {
|
|
99
|
+
mutate: {
|
|
100
|
+
account: {
|
|
101
|
+
delete: accountDelete,
|
|
102
|
+
insert: mock(async () => { }),
|
|
103
|
+
update: mock(async () => { }),
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
query: {},
|
|
107
|
+
};
|
|
108
|
+
await mutators.account.deleteAccount(transaction, {
|
|
109
|
+
id: 'test-account-id-1',
|
|
110
|
+
});
|
|
111
|
+
expect(accountDelete).toHaveBeenCalledWith({
|
|
112
|
+
id: 'test-account-id-1',
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
describe('deleteAlias', () => {
|
|
117
|
+
it('deletes a non-primary alias', async () => {
|
|
118
|
+
const aliasRecord = {
|
|
119
|
+
id: 'test-alias-id-2',
|
|
120
|
+
isPrimary: false,
|
|
121
|
+
};
|
|
122
|
+
const run = mock(async () => aliasRecord);
|
|
123
|
+
const one = mock(() => ({ run }));
|
|
124
|
+
const where = mock(() => ({ one }));
|
|
125
|
+
const accountAliasDelete = mock(async () => { });
|
|
126
|
+
const transaction = {
|
|
127
|
+
mutate: {
|
|
128
|
+
accountAlias: {
|
|
129
|
+
delete: accountAliasDelete,
|
|
130
|
+
insert: mock(async () => { }),
|
|
131
|
+
update: mock(async () => { }),
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
query: {
|
|
135
|
+
accountAlias: {
|
|
136
|
+
where,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
const mutators = createMutators();
|
|
141
|
+
await mutators.account.deleteAlias(transaction, {
|
|
142
|
+
accountId: 'test-account-id-1',
|
|
143
|
+
aliasId: 'test-alias-id-2',
|
|
144
|
+
});
|
|
145
|
+
expect(accountAliasDelete).toHaveBeenCalledWith({
|
|
146
|
+
id: 'test-alias-id-2',
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
it('deletes a primary alias and assigns new primary', async () => {
|
|
150
|
+
const aliasRecord = {
|
|
151
|
+
id: 'test-alias-id-1',
|
|
152
|
+
isPrimary: true,
|
|
153
|
+
};
|
|
154
|
+
const remainingAliases = [
|
|
155
|
+
{
|
|
156
|
+
id: 'test-alias-id-2',
|
|
157
|
+
isPrimary: false,
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
const runOne = mock(async () => aliasRecord);
|
|
161
|
+
const one = mock(() => ({ run: runOne }));
|
|
162
|
+
const runList = mock(async () => remainingAliases);
|
|
163
|
+
const where = mock((field) => {
|
|
164
|
+
if (field === 'accountId') {
|
|
165
|
+
return { run: runList };
|
|
166
|
+
}
|
|
167
|
+
return { one };
|
|
168
|
+
});
|
|
169
|
+
const accountAliasDelete = mock(async () => { });
|
|
170
|
+
const accountAliasUpdate = mock(async () => { });
|
|
171
|
+
const accountUpdate = mock(async () => { });
|
|
172
|
+
const transaction = {
|
|
173
|
+
mutate: {
|
|
174
|
+
account: {
|
|
175
|
+
delete: mock(async () => { }),
|
|
176
|
+
insert: mock(async () => { }),
|
|
177
|
+
update: accountUpdate,
|
|
178
|
+
},
|
|
179
|
+
accountAlias: {
|
|
180
|
+
delete: accountAliasDelete,
|
|
181
|
+
insert: mock(async () => { }),
|
|
182
|
+
update: accountAliasUpdate,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
query: {
|
|
186
|
+
accountAlias: {
|
|
187
|
+
where,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
const mutators = createMutators();
|
|
192
|
+
await mutators.account.deleteAlias(transaction, {
|
|
193
|
+
accountId: 'test-account-id-1',
|
|
194
|
+
aliasId: 'test-alias-id-1',
|
|
195
|
+
});
|
|
196
|
+
expect(accountAliasDelete).toHaveBeenCalledWith({
|
|
197
|
+
id: 'test-alias-id-1',
|
|
198
|
+
});
|
|
199
|
+
expect(accountAliasUpdate).toHaveBeenCalledWith({
|
|
200
|
+
id: 'test-alias-id-2',
|
|
201
|
+
isPrimary: true,
|
|
202
|
+
});
|
|
203
|
+
expect(accountUpdate).toHaveBeenCalledWith({
|
|
204
|
+
id: 'test-account-id-1',
|
|
205
|
+
primaryAliasId: 'test-alias-id-2',
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
describe('setAliasName', () => {
|
|
210
|
+
it('sets alias name', async () => {
|
|
211
|
+
const accountAliasUpdate = mock(async () => { });
|
|
212
|
+
const transaction = {
|
|
213
|
+
mutate: {
|
|
214
|
+
accountAlias: {
|
|
215
|
+
delete: mock(async () => { }),
|
|
216
|
+
insert: mock(async () => { }),
|
|
217
|
+
update: accountAliasUpdate,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
query: {},
|
|
221
|
+
};
|
|
222
|
+
const mutators = createMutators();
|
|
223
|
+
await mutators.account.setAliasName(transaction, {
|
|
224
|
+
accountId: 'test-account-id-1',
|
|
225
|
+
aliasId: 'test-alias-id-1',
|
|
226
|
+
displayName: 'New Name',
|
|
227
|
+
});
|
|
228
|
+
expect(accountAliasUpdate).toHaveBeenCalledWith({
|
|
229
|
+
id: 'test-alias-id-1',
|
|
230
|
+
name: 'New Name',
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
describe('setAliasPrimary', () => {
|
|
235
|
+
it('sets alias as primary', async () => {
|
|
236
|
+
const aliases = [
|
|
237
|
+
{ id: 'test-alias-id-1', isPrimary: true },
|
|
238
|
+
{ id: 'test-alias-id-2', isPrimary: false },
|
|
239
|
+
];
|
|
240
|
+
const run = mock(async () => aliases);
|
|
241
|
+
const where = mock(() => ({ run }));
|
|
242
|
+
const accountAliasUpdate = mock(async () => { });
|
|
243
|
+
const accountUpdate = mock(async () => { });
|
|
244
|
+
const transaction = {
|
|
245
|
+
mutate: {
|
|
246
|
+
account: {
|
|
247
|
+
delete: mock(async () => { }),
|
|
248
|
+
insert: mock(async () => { }),
|
|
249
|
+
update: accountUpdate,
|
|
250
|
+
},
|
|
251
|
+
accountAlias: {
|
|
252
|
+
delete: mock(async () => { }),
|
|
253
|
+
insert: mock(async () => { }),
|
|
254
|
+
update: accountAliasUpdate,
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
query: {
|
|
258
|
+
accountAlias: {
|
|
259
|
+
where,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
const mutators = createMutators();
|
|
264
|
+
await mutators.account.setAliasPrimary(transaction, {
|
|
265
|
+
accountId: 'test-account-id-1',
|
|
266
|
+
aliasId: 'test-alias-id-2',
|
|
267
|
+
});
|
|
268
|
+
expect(accountAliasUpdate).toHaveBeenCalledTimes(2);
|
|
269
|
+
expect(accountAliasUpdate).toHaveBeenCalledWith({
|
|
270
|
+
id: 'test-alias-id-1',
|
|
271
|
+
isPrimary: false,
|
|
272
|
+
});
|
|
273
|
+
expect(accountAliasUpdate).toHaveBeenCalledWith({
|
|
274
|
+
id: 'test-alias-id-2',
|
|
275
|
+
isPrimary: true,
|
|
276
|
+
});
|
|
277
|
+
expect(accountUpdate).toHaveBeenCalledWith({
|
|
278
|
+
id: 'test-account-id-1',
|
|
279
|
+
primaryAliasId: 'test-alias-id-2',
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
describe('setConnectionConfigImapRaw', () => {
|
|
284
|
+
it('sets connection config for IMAP raw', async () => {
|
|
285
|
+
const accountUpdate = mock(async () => { });
|
|
286
|
+
const transaction = {
|
|
287
|
+
mutate: {
|
|
288
|
+
account: {
|
|
289
|
+
delete: mock(async () => { }),
|
|
290
|
+
insert: mock(async () => { }),
|
|
291
|
+
update: accountUpdate,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
query: {},
|
|
295
|
+
};
|
|
296
|
+
const mutators = createMutators();
|
|
297
|
+
await mutators.account.setConnectionConfigImapRaw(transaction, {
|
|
298
|
+
connectionConfig: {
|
|
299
|
+
imapHost: 'imap.example.com',
|
|
300
|
+
imapPassword: 'test-password',
|
|
301
|
+
imapPort: 993,
|
|
302
|
+
imapSocketType: 'SSL',
|
|
303
|
+
imapUser: 'user@example.com',
|
|
304
|
+
smtpHost: 'smtp.example.com',
|
|
305
|
+
smtpPassword: 'test-password',
|
|
306
|
+
smtpPort: 465,
|
|
307
|
+
smtpSocketType: 'SSL',
|
|
308
|
+
smtpUser: 'user@example.com',
|
|
309
|
+
},
|
|
310
|
+
id: 'test-account-id-1',
|
|
311
|
+
});
|
|
312
|
+
expect(accountUpdate).toHaveBeenCalledWith({
|
|
313
|
+
id: 'test-account-id-1',
|
|
314
|
+
imapConnectionStatus: 'AWAITING_CONNECTION',
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
describe('setConnectionConfigOauth', () => {
|
|
319
|
+
it('sets connection config for OAuth', async () => {
|
|
320
|
+
const accountUpdate = mock(async () => { });
|
|
321
|
+
const transaction = {
|
|
322
|
+
mutate: {
|
|
323
|
+
account: {
|
|
324
|
+
delete: mock(async () => { }),
|
|
325
|
+
insert: mock(async () => { }),
|
|
326
|
+
update: accountUpdate,
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
query: {},
|
|
330
|
+
};
|
|
331
|
+
const mutators = createMutators();
|
|
332
|
+
await mutators.account.setConnectionConfigOauth(transaction, {
|
|
333
|
+
connectionConfig: {
|
|
334
|
+
code: 'test-auth-code',
|
|
335
|
+
provider: 'GOOGLE',
|
|
336
|
+
user: 'user@example.com',
|
|
337
|
+
},
|
|
338
|
+
id: 'test-account-id-1',
|
|
339
|
+
});
|
|
340
|
+
expect(accountUpdate).toHaveBeenCalledWith({
|
|
341
|
+
id: 'test-account-id-1',
|
|
342
|
+
imapConnectionStatus: 'AWAITING_CONNECTION',
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
describe('setSettings', () => {
|
|
347
|
+
it('sets account settings', async () => {
|
|
348
|
+
const accountUpdate = mock(async () => { });
|
|
349
|
+
const transaction = {
|
|
350
|
+
mutate: {
|
|
351
|
+
account: {
|
|
352
|
+
delete: mock(async () => { }),
|
|
353
|
+
insert: mock(async () => { }),
|
|
354
|
+
update: accountUpdate,
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
query: {},
|
|
358
|
+
};
|
|
359
|
+
const mutators = createMutators();
|
|
360
|
+
await mutators.account.setSettings(transaction, {
|
|
361
|
+
color: '#00ff00',
|
|
362
|
+
displayName: 'Work Account',
|
|
363
|
+
id: 'test-account-id-1',
|
|
364
|
+
});
|
|
365
|
+
expect(accountUpdate).toHaveBeenCalledWith({
|
|
366
|
+
color: '#00ff00',
|
|
367
|
+
displayName: 'Work Account',
|
|
368
|
+
id: 'test-account-id-1',
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './accountMutators';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/accountMutators/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/accountMutators/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './accountMutators';
|