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:
59
packages/chat-runner/js/conversations.js
Normal file
59
packages/chat-runner/js/conversations.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Chat Runner — chat/conversations suite
|
||||
*
|
||||
* Tests conversation CRUD via the chat-core ext API.
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var api = window.CR.api;
|
||||
|
||||
sw.testing.suite('chat/conversations', async function (s) {
|
||||
var convId;
|
||||
|
||||
s.test('create conversation', async function (t) {
|
||||
var r = await api.post('/conversations', {
|
||||
title: 'Runner Test Convo ' + Date.now(),
|
||||
type: 'direct'
|
||||
});
|
||||
t.assert.ok(r.id, 'conversation has id');
|
||||
t.assert.ok(r.title, 'conversation has title');
|
||||
convId = r.id;
|
||||
s.track('conversation', convId);
|
||||
});
|
||||
|
||||
s.test('get conversation', async function (t) {
|
||||
t.assert.ok(convId, 'convId from previous test');
|
||||
var r = await api.get('/conversations/' + convId);
|
||||
t.assert.eq(r.id, convId, 'id matches');
|
||||
});
|
||||
|
||||
s.test('update conversation', async function (t) {
|
||||
t.assert.ok(convId, 'convId from previous test');
|
||||
var r = await api.put('/conversations/' + convId, {
|
||||
title: 'Updated Convo Title'
|
||||
});
|
||||
t.assert.eq(r.title, 'Updated Convo Title', 'title updated');
|
||||
});
|
||||
|
||||
s.test('list conversations', async function (t) {
|
||||
var r = await api.get('/conversations');
|
||||
var list = Array.isArray(r) ? r : (r.data || []);
|
||||
t.assert.ok(Array.isArray(list), 'response is array');
|
||||
var found = list.some(function (c) { return c.id === convId; });
|
||||
t.assert.ok(found, 'created conversation in list');
|
||||
});
|
||||
|
||||
s.test('delete conversation', async function (t) {
|
||||
t.assert.ok(convId, 'convId from previous test');
|
||||
await api.del('/conversations/' + convId);
|
||||
try {
|
||||
await api.get('/conversations/' + convId);
|
||||
t.assert.ok(false, 'expected error after delete');
|
||||
} catch (e) {
|
||||
t.assert.ok(true, 'conversation not found after delete');
|
||||
}
|
||||
convId = null;
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user