Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
matrix-appservice-discord
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
ARISE
matrix-appservice-discord
Validations
d0798e31
Non vérifiée
Valider
d0798e31
rédigé
Il y a 4 ans
par
László Károlyi
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Fix tests
parent
1eaec326
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
test/test_clientfactory.ts
+5
-5
5 ajouts, 5 suppressions
test/test_clientfactory.ts
test/test_presencehandler.ts
+3
-3
3 ajouts, 3 suppressions
test/test_presencehandler.ts
avec
8 ajouts
et
8 suppressions
test/test_clientfactory.ts
+
5
−
5
Voir le fichier @
d0798e31
...
@@ -76,13 +76,13 @@ describe("ClientFactory", () => {
...
@@ -76,13 +76,13 @@ describe("ClientFactory", () => {
describe
(
"
getDiscordId
"
,
()
=>
{
describe
(
"
getDiscordId
"
,
()
=>
{
it
(
"
should fetch id successfully
"
,
async
()
=>
{
it
(
"
should fetch id successfully
"
,
async
()
=>
{
const
config
=
new
DiscordBridgeConfigAuth
();
const
config
=
new
DiscordBridgeConfigAuth
();
const
cf
=
new
DiscordClientFactory
(
null
);
const
cf
=
new
DiscordClientFactory
(
null
,
config
);
const
discordId
=
await
cf
.
getDiscordId
(
"
passme
"
);
const
discordId
=
await
cf
.
getDiscordId
(
"
passme
"
);
expect
(
discordId
).
equals
(
"
12345
"
);
expect
(
discordId
).
equals
(
"
12345
"
);
});
});
it
(
"
should fail if the token is not recognised
"
,
async
()
=>
{
it
(
"
should fail if the token is not recognised
"
,
async
()
=>
{
const
config
=
new
DiscordBridgeConfigAuth
();
const
config
=
new
DiscordBridgeConfigAuth
();
const
cf
=
new
DiscordClientFactory
(
null
);
const
cf
=
new
DiscordClientFactory
(
null
,
config
);
try
{
try
{
await
cf
.
getDiscordId
(
"
failme
"
);
await
cf
.
getDiscordId
(
"
failme
"
);
throw
new
Error
(
"
didn't fail
"
);
throw
new
Error
(
"
didn't fail
"
);
...
@@ -102,7 +102,7 @@ describe("ClientFactory", () => {
...
@@ -102,7 +102,7 @@ describe("ClientFactory", () => {
});
});
it
(
"
should return cached client
"
,
async
()
=>
{
it
(
"
should return cached client
"
,
async
()
=>
{
const
config
=
new
DiscordBridgeConfigAuth
();
const
config
=
new
DiscordBridgeConfigAuth
();
const
cf
=
new
DiscordClientFactory
(
null
);
const
cf
=
new
DiscordClientFactory
(
null
,
config
);
cf
.
clients
.
set
(
"
@user:localhost
"
,
"
testclient
"
);
cf
.
clients
.
set
(
"
@user:localhost
"
,
"
testclient
"
);
const
client
=
await
cf
.
getClient
(
"
@user:localhost
"
);
const
client
=
await
cf
.
getClient
(
"
@user:localhost
"
);
expect
(
client
).
equals
(
"
testclient
"
);
expect
(
client
).
equals
(
"
testclient
"
);
...
@@ -116,14 +116,14 @@ describe("ClientFactory", () => {
...
@@ -116,14 +116,14 @@ describe("ClientFactory", () => {
});
});
it
(
"
should fetch user client if userid matches
"
,
async
()
=>
{
it
(
"
should fetch user client if userid matches
"
,
async
()
=>
{
const
config
=
new
DiscordBridgeConfigAuth
();
const
config
=
new
DiscordBridgeConfigAuth
();
const
cf
=
new
DiscordClientFactory
(
STORE
);
const
cf
=
new
DiscordClientFactory
(
STORE
,
config
);
const
client
=
await
cf
.
getClient
(
"
@valid:localhost
"
);
const
client
=
await
cf
.
getClient
(
"
@valid:localhost
"
);
expect
(
client
).
is
.
not
.
null
;
expect
(
client
).
is
.
not
.
null
;
expect
(
cf
.
clients
.
has
(
"
@valid:localhost
"
)).
to
.
be
.
true
;
expect
(
cf
.
clients
.
has
(
"
@valid:localhost
"
)).
to
.
be
.
true
;
});
});
it
(
"
should fail if the user client cannot log in
"
,
async
()
=>
{
it
(
"
should fail if the user client cannot log in
"
,
async
()
=>
{
const
config
=
new
DiscordBridgeConfigAuth
();
const
config
=
new
DiscordBridgeConfigAuth
();
const
cf
=
new
DiscordClientFactory
(
STORE
);
const
cf
=
new
DiscordClientFactory
(
STORE
,
config
);
cf
.
botClient
=
1
;
cf
.
botClient
=
1
;
const
client
=
await
cf
.
getClient
(
"
@invalid:localhost
"
);
const
client
=
await
cf
.
getClient
(
"
@invalid:localhost
"
);
expect
(
client
).
to
.
equal
(
cf
.
botClient
);
expect
(
client
).
to
.
equal
(
cf
.
botClient
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
test/test_presencehandler.ts
+
3
−
3
Voir le fichier @
d0798e31
...
@@ -98,7 +98,7 @@ describe("PresenceHandler", () => {
...
@@ -98,7 +98,7 @@ describe("PresenceHandler", () => {
const
member
=
new
MockPresence
(
new
MockUser
(
"
ghi
"
,
"
alice
"
),
"
def
"
,
"
online
"
);
const
member
=
new
MockPresence
(
new
MockUser
(
"
ghi
"
,
"
alice
"
),
"
def
"
,
"
online
"
);
await
handler
.
ProcessUser
(
member
as
any
);
await
handler
.
ProcessUser
(
member
as
any
);
appservice
.
getIntentForSuffix
(
member
.
userID
)
appservice
.
getIntentForSuffix
(
member
.
userID
)
.
underlyingClient
.
wasCalled
(
"
setPresenceStatus
"
,
true
,
"
online
"
,
undefined
);
.
underlyingClient
.
wasCalled
(
"
setPresenceStatus
"
,
true
,
"
online
"
,
""
);
});
});
it
(
"
processes an offline user
"
,
async
()
=>
{
it
(
"
processes an offline user
"
,
async
()
=>
{
lastStatus
=
null
;
lastStatus
=
null
;
...
@@ -106,7 +106,7 @@ describe("PresenceHandler", () => {
...
@@ -106,7 +106,7 @@ describe("PresenceHandler", () => {
const
member
=
new
MockPresence
(
new
MockUser
(
"
abc
"
,
"
alice
"
),
"
def
"
,
"
offline
"
);
const
member
=
new
MockPresence
(
new
MockUser
(
"
abc
"
,
"
alice
"
),
"
def
"
,
"
offline
"
);
await
handler
.
ProcessUser
(
member
as
any
);
await
handler
.
ProcessUser
(
member
as
any
);
appservice
.
getIntentForSuffix
(
member
.
userID
)
appservice
.
getIntentForSuffix
(
member
.
userID
)
.
underlyingClient
.
wasCalled
(
"
setPresenceStatus
"
,
true
,
"
offline
"
,
undefined
);
.
underlyingClient
.
wasCalled
(
"
setPresenceStatus
"
,
true
,
"
offline
"
,
""
);
});
});
it
(
"
processes an idle user
"
,
async
()
=>
{
it
(
"
processes an idle user
"
,
async
()
=>
{
lastStatus
=
null
;
lastStatus
=
null
;
...
@@ -114,7 +114,7 @@ describe("PresenceHandler", () => {
...
@@ -114,7 +114,7 @@ describe("PresenceHandler", () => {
const
member
=
new
MockPresence
(
new
MockUser
(
"
abc
"
,
"
alice
"
),
"
def
"
,
"
idle
"
);
const
member
=
new
MockPresence
(
new
MockUser
(
"
abc
"
,
"
alice
"
),
"
def
"
,
"
idle
"
);
await
handler
.
ProcessUser
(
member
as
any
);
await
handler
.
ProcessUser
(
member
as
any
);
appservice
.
getIntentForSuffix
(
member
.
userID
)
appservice
.
getIntentForSuffix
(
member
.
userID
)
.
underlyingClient
.
wasCalled
(
"
setPresenceStatus
"
,
true
,
"
unavailable
"
,
undefined
);
.
underlyingClient
.
wasCalled
(
"
setPresenceStatus
"
,
true
,
"
unavailable
"
,
""
);
});
});
it
(
"
processes an dnd user
"
,
async
()
=>
{
it
(
"
processes an dnd user
"
,
async
()
=>
{
lastStatus
=
null
;
lastStatus
=
null
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter