@enbox/dwn-sdk-js 0.4.8 → 0.4.9
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/browser.mjs +1 -1
- package/dist/browser.mjs.map +3 -3
- package/dist/esm/src/interfaces/messages-subscribe.js.map +1 -1
- package/dist/esm/src/store/index-level-compound.js.map +1 -1
- package/dist/esm/src/store/level-wrapper.js +6 -2
- package/dist/esm/src/store/level-wrapper.js.map +1 -1
- package/dist/esm/src/utils/jws.js.map +1 -1
- package/dist/esm/tests/dwn.spec.js +5 -5
- package/dist/esm/tests/dwn.spec.js.map +1 -1
- package/dist/esm/tests/features/author-delegated-grant.spec.js +16 -16
- package/dist/esm/tests/features/author-delegated-grant.spec.js.map +1 -1
- package/dist/esm/tests/features/owner-delegated-grant.spec.js +7 -7
- package/dist/esm/tests/features/owner-delegated-grant.spec.js.map +1 -1
- package/dist/esm/tests/features/permissions.spec.js +8 -8
- package/dist/esm/tests/features/permissions.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-composition.spec.js +3 -3
- package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -1
- package/dist/esm/tests/features/records-prune-cross-protocol.spec.js +5 -5
- package/dist/esm/tests/features/records-prune-cross-protocol.spec.js.map +1 -1
- package/dist/esm/tests/features/records-prune.spec.js +15 -15
- package/dist/esm/tests/features/records-prune.spec.js.map +1 -1
- package/dist/esm/tests/features/records-squash.spec.js +9 -9
- package/dist/esm/tests/features/records-squash.spec.js.map +1 -1
- package/dist/esm/tests/features/records-tags.spec.js +28 -28
- package/dist/esm/tests/features/records-tags.spec.js.map +1 -1
- package/dist/esm/tests/features/resumable-tasks.spec.js +3 -3
- package/dist/esm/tests/features/resumable-tasks.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js +2 -2
- package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/filter.fuzz.spec.js +1 -1
- package/dist/esm/tests/fuzz/filter.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js +2 -2
- package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js +4 -4
- package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-subscribe.spec.js +16 -16
- package/dist/esm/tests/handlers/messages-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/handlers/protocols-configure.spec.js +5 -5
- package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -1
- package/dist/esm/tests/handlers/protocols-query.spec.js +11 -11
- package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-delete.spec.js +22 -22
- package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-query.spec.js +120 -120
- package/dist/esm/tests/handlers/records-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-read.spec.js +1 -1
- package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js +10 -10
- package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-write.spec.js +31 -31
- package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
- package/dist/esm/tests/interfaces/protocols-configure.spec.js +4 -4
- package/dist/esm/tests/interfaces/protocols-configure.spec.js.map +1 -1
- package/dist/esm/tests/jose/jws/general.spec.js +4 -4
- package/dist/esm/tests/jose/jws/general.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/nested-roles.spec.js +1 -1
- package/dist/esm/tests/scenarios/nested-roles.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/subscriptions.spec.js +28 -28
- package/dist/esm/tests/scenarios/subscriptions.spec.js.map +1 -1
- package/dist/esm/tests/store/blockstore-mock.spec.js +1 -1
- package/dist/esm/tests/store/blockstore-mock.spec.js.map +1 -1
- package/dist/esm/tests/store/data-store-level.spec.js +3 -3
- package/dist/esm/tests/store/data-store-level.spec.js.map +1 -1
- package/dist/esm/tests/store/index-level.spec.js +83 -83
- package/dist/esm/tests/store/index-level.spec.js.map +1 -1
- package/dist/esm/tests/store/message-store-level.spec.js +2 -2
- package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
- package/dist/esm/tests/store/message-store.spec.js +30 -30
- package/dist/esm/tests/store/message-store.spec.js.map +1 -1
- package/dist/esm/tests/store-dependent-tests.spec.js +5 -0
- package/dist/esm/tests/store-dependent-tests.spec.js.map +1 -1
- package/dist/esm/tests/utils/data-stream.spec.js +15 -15
- package/dist/esm/tests/utils/data-stream.spec.js.map +1 -1
- package/dist/esm/tests/utils/encryption.spec.js +1 -1
- package/dist/esm/tests/utils/encryption.spec.js.map +1 -1
- package/dist/esm/tests/utils/messages.spec.js +8 -8
- package/dist/esm/tests/utils/messages.spec.js.map +1 -1
- package/dist/esm/tests/utils/secp256k1.spec.js +2 -2
- package/dist/esm/tests/utils/secp256k1.spec.js.map +1 -1
- package/dist/esm/tests/utils/secp256r1.spec.js +1 -1
- package/dist/esm/tests/utils/secp256r1.spec.js.map +1 -1
- package/dist/types/src/interfaces/messages-subscribe.d.ts +1 -2
- package/dist/types/src/interfaces/messages-subscribe.d.ts.map +1 -1
- package/dist/types/src/store/index-level-compound.d.ts +2 -4
- package/dist/types/src/store/index-level-compound.d.ts.map +1 -1
- package/dist/types/src/store/level-wrapper.d.ts.map +1 -1
- package/dist/types/src/types/protocols-types.d.ts +1 -1
- package/dist/types/src/types/protocols-types.d.ts.map +1 -1
- package/dist/types/src/utils/jws.d.ts +1 -2
- package/dist/types/src/utils/jws.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/interfaces/messages-subscribe.ts +1 -2
- package/src/store/index-level-compound.ts +2 -5
- package/src/store/level-wrapper.ts +6 -2
- package/src/types/protocols-types.ts +2 -1
- package/src/utils/jws.ts +1 -2
|
@@ -1866,7 +1866,7 @@ export function testRecordsTags() {
|
|
|
1866
1866
|
});
|
|
1867
1867
|
const tagsQueryMatchReply = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
1868
1868
|
expect(tagsQueryMatchReply.status.code).toBe(200);
|
|
1869
|
-
expect(tagsQueryMatchReply.entries
|
|
1869
|
+
expect(tagsQueryMatchReply.entries).toHaveLength(1);
|
|
1870
1870
|
expect(tagsQueryMatchReply.entries[0].recordId).toBe(tagsRecord1.message.recordId);
|
|
1871
1871
|
// update the record with new tags
|
|
1872
1872
|
const updatedRecord = await TestDataGenerator.generateFromRecordsWrite({
|
|
@@ -1883,7 +1883,7 @@ export function testRecordsTags() {
|
|
|
1883
1883
|
// Sanity: Query for the old tag value should return no results
|
|
1884
1884
|
const tagsQueryMatchReply2 = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
1885
1885
|
expect(tagsQueryMatchReply2.status.code).toBe(200);
|
|
1886
|
-
expect(tagsQueryMatchReply2.entries
|
|
1886
|
+
expect(tagsQueryMatchReply2.entries).toHaveLength(0);
|
|
1887
1887
|
});
|
|
1888
1888
|
it('should not index tags when the record is not `latestBaseState`', async () => {
|
|
1889
1889
|
const buildTagIndexSpy = sinon.spy(Records, 'buildTagIndexes');
|
|
@@ -1951,7 +1951,7 @@ export function testRecordsTags() {
|
|
|
1951
1951
|
});
|
|
1952
1952
|
const tagsQueryMatchReply = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
1953
1953
|
expect(tagsQueryMatchReply.status.code).toBe(200);
|
|
1954
|
-
expect(tagsQueryMatchReply.entries
|
|
1954
|
+
expect(tagsQueryMatchReply.entries).toHaveLength(1);
|
|
1955
1955
|
expect(tagsQueryMatchReply.entries[0].recordId).toBe(tagsRecord1.message.recordId);
|
|
1956
1956
|
// negative result same tag different value
|
|
1957
1957
|
let tagsQueryNegative = await TestDataGenerator.generateRecordsQuery({
|
|
@@ -1964,7 +1964,7 @@ export function testRecordsTags() {
|
|
|
1964
1964
|
});
|
|
1965
1965
|
let tagsQueryNegativeReply = await dwn.processMessage(alice.did, tagsQueryNegative.message);
|
|
1966
1966
|
expect(tagsQueryNegativeReply.status.code).toBe(200);
|
|
1967
|
-
expect(tagsQueryNegativeReply.entries
|
|
1967
|
+
expect(tagsQueryNegativeReply.entries).toHaveLength(0);
|
|
1968
1968
|
// negative result different tag same value
|
|
1969
1969
|
tagsQueryNegative = await TestDataGenerator.generateRecordsQuery({
|
|
1970
1970
|
author: alice,
|
|
@@ -1976,7 +1976,7 @@ export function testRecordsTags() {
|
|
|
1976
1976
|
});
|
|
1977
1977
|
tagsQueryNegativeReply = await dwn.processMessage(alice.did, tagsQueryNegative.message);
|
|
1978
1978
|
expect(tagsQueryNegativeReply.status.code).toBe(200);
|
|
1979
|
-
expect(tagsQueryNegativeReply.entries
|
|
1979
|
+
expect(tagsQueryNegativeReply.entries).toHaveLength(0);
|
|
1980
1980
|
});
|
|
1981
1981
|
it('should be able to filter by number match', async () => {
|
|
1982
1982
|
const alice = await TestDataGenerator.generateDidKeyPersona();
|
|
@@ -2004,7 +2004,7 @@ export function testRecordsTags() {
|
|
|
2004
2004
|
});
|
|
2005
2005
|
const tagsQueryMatchReply = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2006
2006
|
expect(tagsQueryMatchReply.status.code).toBe(200);
|
|
2007
|
-
expect(tagsQueryMatchReply.entries
|
|
2007
|
+
expect(tagsQueryMatchReply.entries).toHaveLength(1);
|
|
2008
2008
|
expect(tagsQueryMatchReply.entries[0].recordId).toBe(tagsRecord1.message.recordId);
|
|
2009
2009
|
// negative result same tag different value
|
|
2010
2010
|
let tagsQueryNegative = await TestDataGenerator.generateRecordsQuery({
|
|
@@ -2017,7 +2017,7 @@ export function testRecordsTags() {
|
|
|
2017
2017
|
});
|
|
2018
2018
|
let tagsQueryNegativeReply = await dwn.processMessage(alice.did, tagsQueryNegative.message);
|
|
2019
2019
|
expect(tagsQueryNegativeReply.status.code).toBe(200);
|
|
2020
|
-
expect(tagsQueryNegativeReply.entries
|
|
2020
|
+
expect(tagsQueryNegativeReply.entries).toHaveLength(0);
|
|
2021
2021
|
// negative result different tag same value
|
|
2022
2022
|
tagsQueryNegative = await TestDataGenerator.generateRecordsQuery({
|
|
2023
2023
|
author: alice,
|
|
@@ -2029,7 +2029,7 @@ export function testRecordsTags() {
|
|
|
2029
2029
|
});
|
|
2030
2030
|
tagsQueryNegativeReply = await dwn.processMessage(alice.did, tagsQueryNegative.message);
|
|
2031
2031
|
expect(tagsQueryNegativeReply.status.code).toBe(200);
|
|
2032
|
-
expect(tagsQueryNegativeReply.entries
|
|
2032
|
+
expect(tagsQueryNegativeReply.entries).toHaveLength(0);
|
|
2033
2033
|
});
|
|
2034
2034
|
it('should be able to filter by boolean match', async () => {
|
|
2035
2035
|
// 1. Write a record with a boolean tag `booleanTag` set to true
|
|
@@ -2072,7 +2072,7 @@ export function testRecordsTags() {
|
|
|
2072
2072
|
});
|
|
2073
2073
|
const tagsQueryMatchTrueReply = await dwn.processMessage(alice.did, tagsQueryMatchTrue.message);
|
|
2074
2074
|
expect(tagsQueryMatchTrueReply.status.code).toBe(200);
|
|
2075
|
-
expect(tagsQueryMatchTrueReply.entries
|
|
2075
|
+
expect(tagsQueryMatchTrueReply.entries).toHaveLength(1);
|
|
2076
2076
|
expect(tagsQueryMatchTrueReply.entries[0].recordId).toBe(tagsRecordTrue.message.recordId);
|
|
2077
2077
|
// query for records with a `booleanTag` set to false, should return the record with the false tag
|
|
2078
2078
|
const tagsQueryMatchFalse = await TestDataGenerator.generateRecordsQuery({
|
|
@@ -2085,7 +2085,7 @@ export function testRecordsTags() {
|
|
|
2085
2085
|
});
|
|
2086
2086
|
const tagsQueryMatchFalseReply = await dwn.processMessage(alice.did, tagsQueryMatchFalse.message);
|
|
2087
2087
|
expect(tagsQueryMatchFalseReply.status.code).toBe(200);
|
|
2088
|
-
expect(tagsQueryMatchFalseReply.entries
|
|
2088
|
+
expect(tagsQueryMatchFalseReply.entries).toHaveLength(1);
|
|
2089
2089
|
expect(tagsQueryMatchFalseReply.entries[0].recordId).toBe(tagsRecordFalse.message.recordId);
|
|
2090
2090
|
// negative result for a non existent boolean tag.
|
|
2091
2091
|
const tagsQueryNegative = await TestDataGenerator.generateRecordsQuery({
|
|
@@ -2098,7 +2098,7 @@ export function testRecordsTags() {
|
|
|
2098
2098
|
});
|
|
2099
2099
|
const tagsQueryNegativeReply = await dwn.processMessage(alice.did, tagsQueryNegative.message);
|
|
2100
2100
|
expect(tagsQueryNegativeReply.status.code).toBe(200);
|
|
2101
|
-
expect(tagsQueryNegativeReply.entries
|
|
2101
|
+
expect(tagsQueryNegativeReply.entries).toHaveLength(0);
|
|
2102
2102
|
});
|
|
2103
2103
|
it('should be able to range filter by string value', async () => {
|
|
2104
2104
|
const alice = await TestDataGenerator.generateDidKeyPersona();
|
|
@@ -2153,7 +2153,7 @@ export function testRecordsTags() {
|
|
|
2153
2153
|
});
|
|
2154
2154
|
const queryForAllReply = await dwn.processMessage(alice.did, queryForAll.message);
|
|
2155
2155
|
expect(queryForAllReply.status.code).toBe(200);
|
|
2156
|
-
expect(queryForAllReply.entries
|
|
2156
|
+
expect(queryForAllReply.entries).toHaveLength(4); // all 4 records
|
|
2157
2157
|
// query for first names that begin with 'a' and 'b'
|
|
2158
2158
|
const queryForAtoB = await TestDataGenerator.generateRecordsQuery({
|
|
2159
2159
|
author: alice,
|
|
@@ -2166,7 +2166,7 @@ export function testRecordsTags() {
|
|
|
2166
2166
|
});
|
|
2167
2167
|
const queryForAtoBReply = await dwn.processMessage(alice.did, queryForAtoB.message);
|
|
2168
2168
|
expect(queryForAtoBReply.status.code).toBe(200);
|
|
2169
|
-
expect(queryForAtoBReply.entries
|
|
2169
|
+
expect(queryForAtoBReply.entries).toHaveLength(2);
|
|
2170
2170
|
const atobRecordIds = queryForAtoBReply.entries.map(entry => entry.recordId);
|
|
2171
2171
|
expect(atobRecordIds).toEqual(expect.arrayContaining([aliceRecord.message.recordId, bobRecord.message.recordId]));
|
|
2172
2172
|
// query for first names greater than 'bob'(exclusive of), and less than but inclusive of 'daniel'
|
|
@@ -2181,7 +2181,7 @@ export function testRecordsTags() {
|
|
|
2181
2181
|
});
|
|
2182
2182
|
const queryForBtoDReply = await dwn.processMessage(alice.did, queryForBtoD.message);
|
|
2183
2183
|
expect(queryForBtoDReply.status.code).toBe(200);
|
|
2184
|
-
expect(queryForBtoDReply.entries
|
|
2184
|
+
expect(queryForBtoDReply.entries).toHaveLength(2);
|
|
2185
2185
|
const btodRecordIds = queryForBtoDReply.entries.map(entry => entry.recordId);
|
|
2186
2186
|
expect(btodRecordIds).toEqual(expect.arrayContaining([carolRecord.message.recordId, danielRecord.message.recordId]));
|
|
2187
2187
|
// query for first names that begin with 'carol' onward (inclusive).
|
|
@@ -2196,7 +2196,7 @@ export function testRecordsTags() {
|
|
|
2196
2196
|
});
|
|
2197
2197
|
const queryForCarolOnwardReply = await dwn.processMessage(alice.did, queryForCarolOnward.message);
|
|
2198
2198
|
expect(queryForCarolOnwardReply.status.code).toBe(200);
|
|
2199
|
-
expect(queryForCarolOnwardReply.entries
|
|
2199
|
+
expect(queryForCarolOnwardReply.entries).toHaveLength(2);
|
|
2200
2200
|
const onwardResults = queryForCarolOnwardReply.entries.map(entry => entry.recordId);
|
|
2201
2201
|
expect(onwardResults).toEqual(expect.arrayContaining([carolRecord.message.recordId, danielRecord.message.recordId]));
|
|
2202
2202
|
});
|
|
@@ -2246,7 +2246,7 @@ export function testRecordsTags() {
|
|
|
2246
2246
|
});
|
|
2247
2247
|
const tagsQueryMatchReply = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2248
2248
|
expect(tagsQueryMatchReply.status.code).toBe(200);
|
|
2249
|
-
expect(tagsQueryMatchReply.entries
|
|
2249
|
+
expect(tagsQueryMatchReply.entries).toHaveLength(2);
|
|
2250
2250
|
const matchedRecords = tagsQueryMatchReply.entries.map(entry => entry.recordId);
|
|
2251
2251
|
expect(matchedRecords).toEqual(expect.arrayContaining([tagsRecord1.message.recordId, tagsRecord2.message.recordId]));
|
|
2252
2252
|
// sanity/control: a regular range query will return all
|
|
@@ -2261,7 +2261,7 @@ export function testRecordsTags() {
|
|
|
2261
2261
|
});
|
|
2262
2262
|
const tagsQueryRangeReply = await dwn.processMessage(alice.did, tagsQueryRange.message);
|
|
2263
2263
|
expect(tagsQueryRangeReply.status.code).toBe(200);
|
|
2264
|
-
expect(tagsQueryRangeReply.entries
|
|
2264
|
+
expect(tagsQueryRangeReply.entries).toHaveLength(3); // returned all 3 records
|
|
2265
2265
|
});
|
|
2266
2266
|
it('should be able to range filter by number value', async () => {
|
|
2267
2267
|
const alice = await TestDataGenerator.generateDidKeyPersona();
|
|
@@ -2320,7 +2320,7 @@ export function testRecordsTags() {
|
|
|
2320
2320
|
});
|
|
2321
2321
|
const queryForAllReply = await dwn.processMessage(alice.did, queryForAll.message);
|
|
2322
2322
|
expect(queryForAllReply.status.code).toBe(200);
|
|
2323
|
-
expect(queryForAllReply.entries
|
|
2323
|
+
expect(queryForAllReply.entries).toHaveLength(4); // all 4 records
|
|
2324
2324
|
// query for all records that received higher than(not including) an 80
|
|
2325
2325
|
// only one record should match
|
|
2326
2326
|
const queryForHighGrade = await TestDataGenerator.generateRecordsQuery({
|
|
@@ -2334,7 +2334,7 @@ export function testRecordsTags() {
|
|
|
2334
2334
|
});
|
|
2335
2335
|
const queryForHighReply = await dwn.processMessage(alice.did, queryForHighGrade.message);
|
|
2336
2336
|
expect(queryForHighReply.status.code).toBe(200);
|
|
2337
|
-
expect(queryForHighReply.entries
|
|
2337
|
+
expect(queryForHighReply.entries).toHaveLength(1);
|
|
2338
2338
|
expect(queryForHighReply.entries[0].recordId).toBe(danielRecord.message.recordId);
|
|
2339
2339
|
// query for all records that received higher (and including) a 75
|
|
2340
2340
|
// three records should match
|
|
@@ -2349,7 +2349,7 @@ export function testRecordsTags() {
|
|
|
2349
2349
|
});
|
|
2350
2350
|
const queryForPassingGradeReply = await dwn.processMessage(alice.did, queryForPassingGrade.message);
|
|
2351
2351
|
expect(queryForPassingGradeReply.status.code).toBe(200);
|
|
2352
|
-
expect(queryForPassingGradeReply.entries
|
|
2352
|
+
expect(queryForPassingGradeReply.entries).toHaveLength(3);
|
|
2353
2353
|
const passingRecords = queryForPassingGradeReply.entries.map(entry => entry.recordId);
|
|
2354
2354
|
expect(passingRecords).toEqual(expect.arrayContaining([
|
|
2355
2355
|
danielRecord.message.recordId, bobRecord.message.recordId, aliceRecord.message.recordId
|
|
@@ -2366,7 +2366,7 @@ export function testRecordsTags() {
|
|
|
2366
2366
|
});
|
|
2367
2367
|
const queryForPoorGradesReply = await dwn.processMessage(alice.did, queryForPoorGrades.message);
|
|
2368
2368
|
expect(queryForPoorGradesReply.status.code).toBe(200);
|
|
2369
|
-
expect(queryForPoorGradesReply.entries
|
|
2369
|
+
expect(queryForPoorGradesReply.entries).toHaveLength(1);
|
|
2370
2370
|
expect(queryForPoorGradesReply.entries[0].recordId).toBe(carolRecord.message.recordId);
|
|
2371
2371
|
// query for passing grades that were not perfect scores
|
|
2372
2372
|
const queryForRange = await TestDataGenerator.generateRecordsQuery({
|
|
@@ -2380,7 +2380,7 @@ export function testRecordsTags() {
|
|
|
2380
2380
|
});
|
|
2381
2381
|
const queryForRangeReply = await dwn.processMessage(alice.did, queryForRange.message);
|
|
2382
2382
|
expect(queryForRangeReply.status.code).toBe(200);
|
|
2383
|
-
expect(queryForRangeReply.entries
|
|
2383
|
+
expect(queryForRangeReply.entries).toHaveLength(2);
|
|
2384
2384
|
const rangeRecords = queryForRangeReply.entries.map(entry => entry.recordId);
|
|
2385
2385
|
expect(rangeRecords).toEqual(expect.arrayContaining([bobRecord.message.recordId, aliceRecord.message.recordId]));
|
|
2386
2386
|
});
|
|
@@ -2407,7 +2407,7 @@ export function testRecordsTags() {
|
|
|
2407
2407
|
});
|
|
2408
2408
|
const tagsQueryMatchReply = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2409
2409
|
expect(tagsQueryMatchReply.status.code).toBe(200);
|
|
2410
|
-
expect(tagsQueryMatchReply.entries
|
|
2410
|
+
expect(tagsQueryMatchReply.entries).toHaveLength(1);
|
|
2411
2411
|
expect(tagsQueryMatchReply.entries[0].recordId).toBe(tagsRecord1.message.recordId);
|
|
2412
2412
|
// update the record with new tags
|
|
2413
2413
|
const updatedRecord = await TestDataGenerator.generateFromRecordsWrite({
|
|
@@ -2420,7 +2420,7 @@ export function testRecordsTags() {
|
|
|
2420
2420
|
// issuing the same query should return no results
|
|
2421
2421
|
const tagsQueryMatchReply2 = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2422
2422
|
expect(tagsQueryMatchReply2.status.code).toBe(200);
|
|
2423
|
-
expect(tagsQueryMatchReply2.entries
|
|
2423
|
+
expect(tagsQueryMatchReply2.entries).toHaveLength(0);
|
|
2424
2424
|
});
|
|
2425
2425
|
it('should not return results if the record was updated with empty tags', async () => {
|
|
2426
2426
|
const alice = await TestDataGenerator.generateDidKeyPersona();
|
|
@@ -2445,7 +2445,7 @@ export function testRecordsTags() {
|
|
|
2445
2445
|
});
|
|
2446
2446
|
const tagsQueryMatchReply = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2447
2447
|
expect(tagsQueryMatchReply.status.code).toBe(200);
|
|
2448
|
-
expect(tagsQueryMatchReply.entries
|
|
2448
|
+
expect(tagsQueryMatchReply.entries).toHaveLength(1);
|
|
2449
2449
|
expect(tagsQueryMatchReply.entries[0].recordId).toBe(tagsRecord1.message.recordId);
|
|
2450
2450
|
// update the record without any tags
|
|
2451
2451
|
const updatedRecord = await TestDataGenerator.generateFromRecordsWrite({
|
|
@@ -2457,7 +2457,7 @@ export function testRecordsTags() {
|
|
|
2457
2457
|
// issuing the same query should return no results
|
|
2458
2458
|
const tagsQueryMatchReply2 = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2459
2459
|
expect(tagsQueryMatchReply2.status.code).toBe(200);
|
|
2460
|
-
expect(tagsQueryMatchReply2.entries
|
|
2460
|
+
expect(tagsQueryMatchReply2.entries).toHaveLength(0);
|
|
2461
2461
|
});
|
|
2462
2462
|
});
|
|
2463
2463
|
describe('RecordsDelete with tags', () => {
|
|
@@ -2486,7 +2486,7 @@ export function testRecordsTags() {
|
|
|
2486
2486
|
});
|
|
2487
2487
|
const tagsQueryMatchReply = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2488
2488
|
expect(tagsQueryMatchReply.status.code).toBe(200);
|
|
2489
|
-
expect(tagsQueryMatchReply.entries
|
|
2489
|
+
expect(tagsQueryMatchReply.entries).toHaveLength(1);
|
|
2490
2490
|
expect(tagsQueryMatchReply.entries[0].recordId).toBe(tagsRecord1.message.recordId);
|
|
2491
2491
|
// delete the record
|
|
2492
2492
|
const recordDelete = await TestDataGenerator.generateRecordsDelete({
|
|
@@ -2498,7 +2498,7 @@ export function testRecordsTags() {
|
|
|
2498
2498
|
// issue the the same query should return no results
|
|
2499
2499
|
const tagsQueryMatchReply2 = await dwn.processMessage(alice.did, tagsQueryMatch.message);
|
|
2500
2500
|
expect(tagsQueryMatchReply2.status.code).toBe(200);
|
|
2501
|
-
expect(tagsQueryMatchReply2.entries
|
|
2501
|
+
expect(tagsQueryMatchReply2.entries).toHaveLength(0);
|
|
2502
2502
|
});
|
|
2503
2503
|
});
|
|
2504
2504
|
});
|