Feat v0.7.2 package runners ci gate (#56)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m39s
CI/CD / test-sqlite (push) Successful in 2m55s
CI/CD / build-and-deploy (push) Successful in 29s
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m39s
CI/CD / test-sqlite (push) Successful in 2m55s
CI/CD / build-and-deploy (push) Successful in 29s
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #56.
This commit is contained in:
60
packages/chat-runner/js/messaging.js
Normal file
60
packages/chat-runner/js/messaging.js
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Chat Runner — chat/messaging suite
|
||||
*
|
||||
* Tests message CRUD and search within conversations.
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var api = window.CR.api;
|
||||
|
||||
sw.testing.suite('chat/messaging', async function (s) {
|
||||
var convId, msgId;
|
||||
|
||||
s.beforeAll(async function () {
|
||||
var r = await api.post('/conversations', {
|
||||
title: 'Messaging Test ' + Date.now(),
|
||||
type: 'direct'
|
||||
});
|
||||
convId = r.id;
|
||||
s.track('conversation', convId);
|
||||
});
|
||||
|
||||
s.test('send message', async function (t) {
|
||||
var r = await api.post('/messages/' + convId, {
|
||||
content: 'Hello from chat-runner test!',
|
||||
content_type: 'text'
|
||||
});
|
||||
t.assert.ok(r.id, 'message has id');
|
||||
t.assert.ok(r.content, 'message has content');
|
||||
msgId = r.id;
|
||||
});
|
||||
|
||||
s.test('list messages', async function (t) {
|
||||
var r = await api.get('/messages/' + convId);
|
||||
var list = Array.isArray(r) ? r : (r.data || r.messages || []);
|
||||
t.assert.ok(Array.isArray(list), 'messages is array');
|
||||
t.assert.ok(list.length > 0, 'at least one message');
|
||||
var found = list.some(function (m) { return m.id === msgId; });
|
||||
t.assert.ok(found, 'sent message appears in list');
|
||||
});
|
||||
|
||||
s.test('search conversations', async function (t) {
|
||||
var r = await api.get('/search?q=chat-runner');
|
||||
var list = Array.isArray(r) ? r : (r.data || r.conversations || r.results || []);
|
||||
t.assert.ok(Array.isArray(list), 'search returns array');
|
||||
if (list.length === 0) {
|
||||
t.warn('Search returned empty — may need time for indexing');
|
||||
}
|
||||
});
|
||||
|
||||
s.test('mark read', async function (t) {
|
||||
try {
|
||||
await api.post('/read/' + convId, {});
|
||||
t.assert.ok(true, 'mark read succeeded');
|
||||
} catch (e) {
|
||||
t.warn('mark read failed: ' + e.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user