Feat v0.7.1 surface runner framework (#55)
All checks were successful
All checks were successful
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #55.
This commit is contained in:
@@ -88,10 +88,10 @@
|
||||
|
||||
// ── Tests ────────────────────────────────────────────────
|
||||
|
||||
T.registerDomain('composition', async function () {
|
||||
sw.testing.suite('sdk/composition', async function (s) {
|
||||
|
||||
if (!window.sw || !sw.isAdmin) {
|
||||
await T.test('composition', 'guard', 'skip — not admin', async function () {
|
||||
s.test('guard: skip — not admin', async function (t) {
|
||||
T.assert(true, 'skipped (user is not admin)');
|
||||
});
|
||||
return;
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
// ── 1. Install library with connection type ────────────
|
||||
|
||||
await T.test('composition', 'install-library', 'install library with connection type declaration', async function () {
|
||||
s.test('install-library: install library with connection type declaration', async function (t) {
|
||||
var manifest = {
|
||||
id: libId,
|
||||
title: 'Composition Test Library',
|
||||
@@ -138,14 +138,14 @@
|
||||
|
||||
// ── 2. Grant library permissions ────────────
|
||||
|
||||
await T.test('composition', 'grant-permissions', 'grant library declared permissions', async function () {
|
||||
s.test('grant-permissions: grant library declared permissions', async function (t) {
|
||||
var r = await sw.api.post('/api/v1/admin/extensions/' + libId + '/permissions/grant-all', {});
|
||||
T.assert(true, 'permissions granted (or already granted)');
|
||||
});
|
||||
|
||||
// ── 3. Connection type appears in discovery endpoint ────
|
||||
|
||||
await T.test('composition', 'types-include-library', 'connection-types endpoint includes library type', async function () {
|
||||
s.test('types-include-library: connection-types endpoint includes library type', async function (t) {
|
||||
var types = await sw.api.connectionTypes.list();
|
||||
T.assert(Array.isArray(types), 'should be array');
|
||||
var found = types.find(function (t) { return t.type === connType; });
|
||||
@@ -158,7 +158,7 @@
|
||||
|
||||
// ── 4. Create connection of library's type ────────────
|
||||
|
||||
await T.test('composition', 'create-connection', 'create connection of library connection type', async function () {
|
||||
s.test('create-connection: create connection of library connection type', async function (t) {
|
||||
var r = await sw.api.admin.connections.create({
|
||||
type: connType,
|
||||
package_id: libId,
|
||||
@@ -176,7 +176,7 @@
|
||||
|
||||
// ── 5. Install consumer with dependency on library ────
|
||||
|
||||
await T.test('composition', 'install-consumer', 'install consumer depending on library', async function () {
|
||||
s.test('install-consumer: install consumer depending on library', async function (t) {
|
||||
var manifest = {
|
||||
id: consumerId,
|
||||
title: 'Composition Test Consumer',
|
||||
@@ -201,28 +201,28 @@
|
||||
|
||||
// ── 6. Verify dependency recorded ────────────
|
||||
|
||||
await T.test('composition', 'dependency-recorded', 'consumer depends on library', async function () {
|
||||
s.test('dependency-recorded: consumer depends on library', async function (t) {
|
||||
var r = await sw.api.admin.packages.dependencies(consumerId);
|
||||
T.assert(r && r.data, 'should return data');
|
||||
var dep = r.data.find(function (d) { return d.library_id === libId; });
|
||||
var deps = Array.isArray(r) ? r : (r && r.data) || [];
|
||||
var dep = deps.find(function (d) { return d.library_id === libId; });
|
||||
T.assert(dep, 'dependency on library should exist');
|
||||
});
|
||||
|
||||
// ── 7. Cleanup: consumer, connection, library ────────────
|
||||
|
||||
await T.test('composition', 'cleanup-consumer', 'uninstall consumer', async function () {
|
||||
s.test('cleanup-consumer: uninstall consumer', async function (t) {
|
||||
await sw.api.admin.packages.del(consumerId);
|
||||
consumerId = null;
|
||||
T.assert(true, 'consumer uninstalled');
|
||||
});
|
||||
|
||||
await T.test('composition', 'cleanup-connection', 'delete connection', async function () {
|
||||
s.test('cleanup-connection: delete connection', async function (t) {
|
||||
await sw.api.admin.connections.del(connId);
|
||||
connId = null;
|
||||
T.assert(true, 'connection deleted');
|
||||
});
|
||||
|
||||
await T.test('composition', 'cleanup-library', 'uninstall library', async function () {
|
||||
s.test('cleanup-library: uninstall library', async function (t) {
|
||||
await sw.api.admin.packages.del(libId);
|
||||
libId = null;
|
||||
T.assert(true, 'library uninstalled');
|
||||
@@ -230,7 +230,7 @@
|
||||
|
||||
// ── 8. Verify type removed after uninstall ────────────
|
||||
|
||||
await T.test('composition', 'types-removed', 'connection type removed after library uninstall', async function () {
|
||||
s.test('types-removed: connection type removed after library uninstall', async function (t) {
|
||||
var types = await sw.api.connectionTypes.list();
|
||||
var found = types.find(function (t) { return t.type === connType; });
|
||||
T.assert(!found, 'type should not appear after library uninstall');
|
||||
|
||||
Reference in New Issue
Block a user