CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
resolve-sandbox-image.test.mjs43 linesDownload Raw Back to scripts
1import assert from 'node:assert/strict';2import test from 'node:test';3 4import {5  latestSemverTag,6  validateRequestedImage,7} from './resolve-sandbox-image.mjs';8 9test('latestSemverTag returns the highest stable semver tag', () => {10  assert.equal(11    latestSemverTag([12      'latest',13      '0.19',14      '0.19.4',15      '0.19.10',16      '0.20.0-rc.1',17      'sha-abc123',18      '0.20.0',19    ]),20    '0.20.0',21  );22});23 24test('latestSemverTag ignores non-stable tags', () => {25  assert.equal(latestSemverTag(['latest', '0.19', 'sha-abc123']), undefined);26});27 28test('validateRequestedImage accepts a configured image', () => {29  assert.equal(30    validateRequestedImage(' ghcr.io/qwenlm/qwen-code:0.1.0 '),31    'ghcr.io/qwenlm/qwen-code:0.1.0',32  );33});34 35test('validateRequestedImage rejects missing package config output', () => {36  for (const value of [undefined, '', ' ', 'undefined', 'null']) {37    assert.throws(38      () => validateRequestedImage(value),39      /package\.json config\.sandboxImageUri/,40    );41  }42});43 
basant307/AI_Governance_Project · CoolFace