-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fixing unstable tests and moving old
- Loading branch information
Mateusz Russak
committed
Dec 16, 2023
1 parent
6b8777d
commit 82cf881
Showing
10 changed files
with
56 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const assert = require('assert'); | ||
const api = require('./api'); | ||
|
||
describe('fcm:setup', () => { | ||
let user; | ||
before(async () => { | ||
await api.repo.user.update({ login: 'admin' }, { notifications: {} }); | ||
user = await api.repo.user.get({ login: 'admin' }); | ||
}); | ||
it('should update fcm token for current session', async () => { | ||
const token = 'testToken'; | ||
const { res } = await api.sendMessage({ | ||
type: 'fcm:setup', | ||
token, | ||
}, { userId: user.id }); | ||
assert.equal(res.type, 'response'); | ||
assert.equal(res.status, 'ok'); | ||
const updatedUser = await api.repo.user.get({ id: user.id }); | ||
assert.ok(updatedUser.notifications[token]); | ||
}); | ||
it('should throw error when token is not present', async () => { | ||
const { res } = await api.sendMessage({ | ||
type: 'fcm:setup', | ||
}).catch((e) => e); | ||
assert.equal(res.status, 'error'); | ||
assert.equal(res.message, '"token" is required'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
module.exports = (connect) => { | ||
describe('actions', () => { | ||
require('./message.spec')(connect); | ||
require('./setupFcm.spec')(connect); | ||
require('./typing.spec')(connect); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters