11import { SearchType } from '../shapes/search.js' ;
22import { deleteAllDataForUser , exportDataForUser } from './bulk-queries.js' ;
3+ import { client } from './client.js' ;
34import { getItemAnnotationsForProfile , updateItemAnnotation } from './item-annotations-queries.js' ;
45import { getItemHashTagsForProfile , updateItemHashTag } from './item-hash-tags-queries.js' ;
56import { getLoadoutsForProfile , updateLoadout } from './loadouts-queries.js' ;
67import { loadout } from './loadouts-queries.test.js' ;
7- import { getSearchesForProfile , updateUsedSearch } from './searches-queries.js' ;
8+ import { getSearchesForProfile , updateSearches } from './searches-queries.js' ;
89import { getSettings , setSetting } from './settings-queries.js' ;
9- import { getTrackedTriumphsForProfile , trackTriumph } from './triumphs-queries.js' ;
10+ import { getTrackedTriumphsForProfile , trackUntrackTriumphs } from './triumphs-queries.js' ;
1011
1112const platformMembershipId = '213512057' ;
1213const bungieMembershipId = 4321 ;
@@ -15,27 +16,39 @@ beforeEach(async () => deleteAllDataForUser(bungieMembershipId, [platformMembers
1516
1617describe ( 'deleteAllDataForUser' , ( ) => {
1718 it ( 'should delete all kinds of data' , async ( ) => {
18- await updateItemAnnotation ( platformMembershipId , 2 , {
19- id : '123456' ,
20- tag : 'favorite' ,
21- notes : 'the best' ,
22- } ) ;
23- await updateItemAnnotation ( platformMembershipId , 1 , {
24- id : '1234567' ,
25- tag : 'favorite' ,
26- notes : 'the best??' ,
27- } ) ;
28- await updateItemHashTag ( platformMembershipId , {
29- hash : 2926662838 ,
30- tag : 'favorite' ,
31- notes : 'the best' ,
32- } ) ;
33- await updateLoadout ( platformMembershipId , 2 , loadout ) ;
34- await updateUsedSearch ( platformMembershipId , 1 , 'is:handcannon' , SearchType . Item ) ;
35- await updateUsedSearch ( platformMembershipId , 2 , 'tag:junk' , SearchType . Item ) ;
36- await trackTriumph ( platformMembershipId , 3851137658 ) ;
37- await setSetting ( bungieMembershipId , {
38- showNewItems : true ,
19+ await client . transaction ( async ( txn ) => {
20+ await updateItemAnnotation ( txn , platformMembershipId , 2 , [
21+ {
22+ id : '123456' ,
23+ tag : 'favorite' ,
24+ notes : 'the best' ,
25+ } ,
26+ ] ) ;
27+ await updateItemAnnotation ( txn , platformMembershipId , 1 , [
28+ {
29+ id : '1234567' ,
30+ tag : 'favorite' ,
31+ notes : 'the best??' ,
32+ } ,
33+ ] ) ;
34+ await updateItemHashTag ( txn , platformMembershipId , {
35+ hash : 2926662838 ,
36+ tag : 'favorite' ,
37+ notes : 'the best' ,
38+ } ) ;
39+ await updateLoadout ( txn , platformMembershipId , 2 , [ loadout ] ) ;
40+ await updateSearches ( txn , platformMembershipId , 1 , [
41+ { query : 'is:handcannon' , type : SearchType . Item , incrementUsed : 1 , saved : false } ,
42+ ] ) ;
43+ await updateSearches ( txn , platformMembershipId , 2 , [
44+ { query : 'tag:junk' , type : SearchType . Item , incrementUsed : 1 , saved : false } ,
45+ ] ) ;
46+ await trackUntrackTriumphs ( txn , platformMembershipId , [
47+ { recordHash : 3851137658 , tracked : true } ,
48+ ] ) ;
49+ await setSetting ( txn , bungieMembershipId , {
50+ showNewItems : true ,
51+ } ) ;
3952 } ) ;
4053
4154 await deleteAllDataForUser ( bungieMembershipId , [ platformMembershipId ] ) ;
@@ -57,27 +70,39 @@ describe('deleteAllDataForUser', () => {
5770
5871describe ( 'exportDataForUser' , ( ) => {
5972 it ( 'should delete all kinds of data' , async ( ) => {
60- await updateItemAnnotation ( platformMembershipId , 2 , {
61- id : '123456' ,
62- tag : 'favorite' ,
63- notes : 'the best' ,
64- } ) ;
65- await updateItemAnnotation ( platformMembershipId , 1 , {
66- id : '1234567' ,
67- tag : 'favorite' ,
68- notes : 'the best??' ,
69- } ) ;
70- await updateItemHashTag ( platformMembershipId , {
71- hash : 2926662838 ,
72- tag : 'favorite' ,
73- notes : 'the best' ,
74- } ) ;
75- await updateLoadout ( platformMembershipId , 2 , loadout ) ;
76- await updateUsedSearch ( platformMembershipId , 1 , 'is:handcannon' , SearchType . Item ) ;
77- await updateUsedSearch ( platformMembershipId , 2 , 'tag:junk' , SearchType . Item ) ;
78- await trackTriumph ( platformMembershipId , 3851137658 ) ;
79- await setSetting ( bungieMembershipId , {
80- showNewItems : true ,
73+ await client . transaction ( async ( txn ) => {
74+ await updateItemAnnotation ( txn , platformMembershipId , 2 , [
75+ {
76+ id : '123456' ,
77+ tag : 'favorite' ,
78+ notes : 'the best' ,
79+ } ,
80+ ] ) ;
81+ await updateItemAnnotation ( txn , platformMembershipId , 1 , [
82+ {
83+ id : '1234567' ,
84+ tag : 'favorite' ,
85+ notes : 'the best??' ,
86+ } ,
87+ ] ) ;
88+ await updateItemHashTag ( txn , platformMembershipId , {
89+ hash : 2926662838 ,
90+ tag : 'favorite' ,
91+ notes : 'the best' ,
92+ } ) ;
93+ await updateLoadout ( txn , platformMembershipId , 2 , [ loadout ] ) ;
94+ await updateSearches ( txn , platformMembershipId , 1 , [
95+ { query : 'is:handcannon' , type : SearchType . Item , incrementUsed : 1 , saved : false } ,
96+ ] ) ;
97+ await updateSearches ( txn , platformMembershipId , 2 , [
98+ { query : 'tag:junk' , type : SearchType . Item , incrementUsed : 1 , saved : false } ,
99+ ] ) ;
100+ await trackUntrackTriumphs ( txn , platformMembershipId , [
101+ { recordHash : 3851137658 , tracked : true } ,
102+ ] ) ;
103+ await setSetting ( txn , bungieMembershipId , {
104+ showNewItems : true ,
105+ } ) ;
81106 } ) ;
82107
83108 const exportResponse = await exportDataForUser ( bungieMembershipId , [ platformMembershipId ] ) ;
0 commit comments