Fix order of the communities

This commit is contained in:
elweyn 2023-04-11 09:44:21 +02:00
parent 5f0788ee9c
commit 4cea48aeb8

View File

@ -56,7 +56,7 @@ describe('CommunityResolver', () => {
homeCom1.foreign = false homeCom1.foreign = false
homeCom1.publicKey = Buffer.from('publicKey-HomeCommunity') homeCom1.publicKey = Buffer.from('publicKey-HomeCommunity')
homeCom1.apiVersion = '1_0' homeCom1.apiVersion = '1_0'
homeCom1.endPoint = 'http://localhost' homeCom1.endPoint = 'http://localhost/api'
homeCom1.createdAt = new Date() homeCom1.createdAt = new Date()
await DbCommunity.insert(homeCom1) await DbCommunity.insert(homeCom1)
@ -64,7 +64,7 @@ describe('CommunityResolver', () => {
homeCom2.foreign = false homeCom2.foreign = false
homeCom2.publicKey = Buffer.from('publicKey-HomeCommunity') homeCom2.publicKey = Buffer.from('publicKey-HomeCommunity')
homeCom2.apiVersion = '1_1' homeCom2.apiVersion = '1_1'
homeCom2.endPoint = 'http://localhost' homeCom2.endPoint = 'http://localhost/api'
homeCom2.createdAt = new Date() homeCom2.createdAt = new Date()
await DbCommunity.insert(homeCom2) await DbCommunity.insert(homeCom2)
@ -72,7 +72,7 @@ describe('CommunityResolver', () => {
homeCom3.foreign = false homeCom3.foreign = false
homeCom3.publicKey = Buffer.from('publicKey-HomeCommunity') homeCom3.publicKey = Buffer.from('publicKey-HomeCommunity')
homeCom3.apiVersion = '2_0' homeCom3.apiVersion = '2_0'
homeCom3.endPoint = 'http://localhost' homeCom3.endPoint = 'http://localhost/api'
homeCom3.createdAt = new Date() homeCom3.createdAt = new Date()
await DbCommunity.insert(homeCom3) await DbCommunity.insert(homeCom3)
}) })
@ -82,14 +82,14 @@ describe('CommunityResolver', () => {
data: { data: {
getCommunities: [ getCommunities: [
{ {
id: 1, id: 3,
foreign: homeCom1.foreign, foreign: homeCom3.foreign,
publicKey: expect.stringMatching('publicKey-HomeCommunity'), publicKey: expect.stringMatching('publicKey-HomeCommunity'),
url: expect.stringMatching('http://localhost/api/1_0'), url: expect.stringMatching('http://localhost/api/2_0'),
lastAnnouncedAt: null, lastAnnouncedAt: null,
verifiedAt: null, verifiedAt: null,
lastErrorAt: null, lastErrorAt: null,
createdAt: homeCom1.createdAt.toISOString(), createdAt: homeCom3.createdAt.toISOString(),
updatedAt: null, updatedAt: null,
}, },
{ {
@ -104,14 +104,14 @@ describe('CommunityResolver', () => {
updatedAt: null, updatedAt: null,
}, },
{ {
id: 3, id: 1,
foreign: homeCom3.foreign, foreign: homeCom1.foreign,
publicKey: expect.stringMatching('publicKey-HomeCommunity'), publicKey: expect.stringMatching('publicKey-HomeCommunity'),
url: expect.stringMatching('http://localhost/api/2_0'), url: expect.stringMatching('http://localhost/api/1_0'),
lastAnnouncedAt: null, lastAnnouncedAt: null,
verifiedAt: null, verifiedAt: null,
lastErrorAt: null, lastErrorAt: null,
createdAt: homeCom3.createdAt.toISOString(), createdAt: homeCom1.createdAt.toISOString(),
updatedAt: null, updatedAt: null,
}, },
], ],
@ -128,7 +128,7 @@ describe('CommunityResolver', () => {
foreignCom1.foreign = true foreignCom1.foreign = true
foreignCom1.publicKey = Buffer.from('publicKey-ForeignCommunity') foreignCom1.publicKey = Buffer.from('publicKey-ForeignCommunity')
foreignCom1.apiVersion = '1_0' foreignCom1.apiVersion = '1_0'
foreignCom1.endPoint = 'http://remotehost' foreignCom1.endPoint = 'http://remotehost/api'
foreignCom1.createdAt = new Date() foreignCom1.createdAt = new Date()
await DbCommunity.insert(foreignCom1) await DbCommunity.insert(foreignCom1)
@ -136,7 +136,7 @@ describe('CommunityResolver', () => {
foreignCom2.foreign = true foreignCom2.foreign = true
foreignCom2.publicKey = Buffer.from('publicKey-ForeignCommunity') foreignCom2.publicKey = Buffer.from('publicKey-ForeignCommunity')
foreignCom2.apiVersion = '1_1' foreignCom2.apiVersion = '1_1'
foreignCom2.endPoint = 'http://remotehost' foreignCom2.endPoint = 'http://remotehost/api'
foreignCom2.createdAt = new Date() foreignCom2.createdAt = new Date()
await DbCommunity.insert(foreignCom2) await DbCommunity.insert(foreignCom2)
@ -144,7 +144,7 @@ describe('CommunityResolver', () => {
foreignCom3.foreign = true foreignCom3.foreign = true
foreignCom3.publicKey = Buffer.from('publicKey-ForeignCommunity') foreignCom3.publicKey = Buffer.from('publicKey-ForeignCommunity')
foreignCom3.apiVersion = '1_2' foreignCom3.apiVersion = '1_2'
foreignCom3.endPoint = 'http://remotehost' foreignCom3.endPoint = 'http://remotehost/api'
foreignCom3.createdAt = new Date() foreignCom3.createdAt = new Date()
await DbCommunity.insert(foreignCom3) await DbCommunity.insert(foreignCom3)
}) })
@ -154,14 +154,14 @@ describe('CommunityResolver', () => {
data: { data: {
getCommunities: [ getCommunities: [
{ {
id: 1, id: 3,
foreign: homeCom1.foreign, foreign: homeCom3.foreign,
publicKey: expect.stringMatching('publicKey-HomeCommunity'), publicKey: expect.stringMatching('publicKey-HomeCommunity'),
url: expect.stringMatching('http://localhost/api/1_0'), url: expect.stringMatching('http://localhost/api/2_0'),
lastAnnouncedAt: null, lastAnnouncedAt: null,
verifiedAt: null, verifiedAt: null,
lastErrorAt: null, lastErrorAt: null,
createdAt: homeCom1.createdAt.toISOString(), createdAt: homeCom3.createdAt.toISOString(),
updatedAt: null, updatedAt: null,
}, },
{ {
@ -176,25 +176,25 @@ describe('CommunityResolver', () => {
updatedAt: null, updatedAt: null,
}, },
{ {
id: 3, id: 1,
foreign: homeCom3.foreign, foreign: homeCom1.foreign,
publicKey: expect.stringMatching('publicKey-HomeCommunity'), publicKey: expect.stringMatching('publicKey-HomeCommunity'),
url: expect.stringMatching('http://localhost/api/2_0'), url: expect.stringMatching('http://localhost/api/1_0'),
lastAnnouncedAt: null, lastAnnouncedAt: null,
verifiedAt: null, verifiedAt: null,
lastErrorAt: null, lastErrorAt: null,
createdAt: homeCom3.createdAt.toISOString(), createdAt: homeCom1.createdAt.toISOString(),
updatedAt: null, updatedAt: null,
}, },
{ {
id: 4, id: 6,
foreign: foreignCom1.foreign, foreign: foreignCom3.foreign,
publicKey: expect.stringMatching('publicKey-ForeignCommunity'), publicKey: expect.stringMatching('publicKey-ForeignCommunity'),
url: expect.stringMatching('http://remotehost/api/1_0'), url: expect.stringMatching('http://remotehost/api/1_2'),
lastAnnouncedAt: null, lastAnnouncedAt: null,
verifiedAt: null, verifiedAt: null,
lastErrorAt: null, lastErrorAt: null,
createdAt: foreignCom1.createdAt.toISOString(), createdAt: foreignCom3.createdAt.toISOString(),
updatedAt: null, updatedAt: null,
}, },
{ {
@ -209,14 +209,14 @@ describe('CommunityResolver', () => {
updatedAt: null, updatedAt: null,
}, },
{ {
id: 6, id: 4,
foreign: foreignCom3.foreign, foreign: foreignCom1.foreign,
publicKey: expect.stringMatching('publicKey-ForeignCommunity'), publicKey: expect.stringMatching('publicKey-ForeignCommunity'),
url: expect.stringMatching('http://remotehost/api/1_2'), url: expect.stringMatching('http://remotehost/api/1_0'),
lastAnnouncedAt: null, lastAnnouncedAt: null,
verifiedAt: null, verifiedAt: null,
lastErrorAt: null, lastErrorAt: null,
createdAt: foreignCom3.createdAt.toISOString(), createdAt: foreignCom1.createdAt.toISOString(),
updatedAt: null, updatedAt: null,
}, },
], ],