hatch-surf/node_modules/node-exports-info/test/getCategoryInfo.js
Riley Zhang df378d33ef
Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Merge GitHub main into Gitea repo (allow unrelated histories)
Resolved conflicts by taking GitHub versions for:
- .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml

Kept deploy.sh updated to:
- Pull from GitHub (primary source)
- Push to Gitea (push-mirror)
- Build from site/ directory (GitHub structure)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-25 05:20:46 +02:00

70 lines
1.7 KiB
JavaScript

'use strict';
var test = require('tape');
var forEach = require('for-each');
var getCategoryInfo = require('../getCategoryInfo');
var getCategoryFlags = require('../getCategoryFlags');
var getConditionsForCategory = require('../getConditionsForCategory');
var getRangePairs = require('../getRangePairs');
test('getCategoryInfo', function (t) {
t['throws'](
// @ts-expect-error
function () { getCategoryInfo('not a category'); },
RangeError,
'invalid category throws'
);
forEach(getRangePairs(), function (pair) {
var category = pair[1];
t.test('category: ' + category, function (st) {
var info = getCategoryInfo(category);
st.ok(
info && typeof info === 'object',
'returns an object'
);
st.ok(
'conditions' in info,
'has conditions property'
);
st.ok(
'flags' in info && info.flags && typeof info.flags === 'object',
'has flags object'
);
// Verify it matches individual function results
st.deepEqual(
info.conditions,
getConditionsForCategory(category, 'require'),
'conditions match getConditionsForCategory with require'
);
st.deepEqual(
info.flags,
getCategoryFlags(category),
'flags match getCategoryFlags'
);
// Test with explicit moduleSystem
var importInfo = getCategoryInfo(category, 'import');
st.deepEqual(
importInfo.conditions,
getConditionsForCategory(category, 'import'),
'import conditions match getConditionsForCategory with import'
);
var requireInfo = getCategoryInfo(category, 'require');
st.deepEqual(
requireInfo.conditions,
getConditionsForCategory(category, 'require'),
'require conditions match getConditionsForCategory with require'
);
st.end();
});
});
t.end();
});