Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
This commit is contained in:
commit
b4150c8250
1364 changed files with 6814366 additions and 0 deletions
68
vendor/zapier-platform/example-apps/onedrive/test/utils.js
vendored
Normal file
68
vendor/zapier-platform/example-apps/onedrive/test/utils.js
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
'use strict';
|
||||
|
||||
require('should');
|
||||
|
||||
const utils = require('../utils');
|
||||
const extractParentsFromPath = utils.extractParentsFromPath;
|
||||
const getStringByteSize = utils.getStringByteSize;
|
||||
|
||||
describe('Utils', () => {
|
||||
it('should extract parents from a folder path', () => {
|
||||
let parents = extractParentsFromPath('/Some/Kind of /Test');
|
||||
|
||||
parents.length.should.eql(3);
|
||||
|
||||
parents[0].id.should.eql(-1);
|
||||
parents[0].name.should.eql('/');
|
||||
parents[0]._path.should.eql('');
|
||||
parents[0].should.have.property('folder');
|
||||
parents[0].should.not.have.property('file');
|
||||
|
||||
parents[1].id.should.eql(-2);
|
||||
parents[1].name.should.eql('Some');
|
||||
parents[1]._path.should.eql('/Some');
|
||||
parents[1].should.have.property('folder');
|
||||
parents[1].should.not.have.property('file');
|
||||
|
||||
parents[2].id.should.eql(-3);
|
||||
parents[2].name.should.eql('Kind of ');
|
||||
parents[2]._path.should.eql('/Some/Kind of ');
|
||||
parents[2].should.have.property('folder');
|
||||
parents[2].should.not.have.property('file');
|
||||
|
||||
parents = extractParentsFromPath('/Zapier');
|
||||
|
||||
parents.length.should.eql(1);
|
||||
|
||||
parents[0].id.should.eql(-1);
|
||||
parents[0].name.should.eql('/');
|
||||
parents[0]._path.should.eql('');
|
||||
parents[0].should.have.property('folder');
|
||||
parents[0].should.not.have.property('file');
|
||||
});
|
||||
|
||||
it('should correctly compute the byte size of strings', () => {
|
||||
const tests = [
|
||||
{
|
||||
string: 'asd',
|
||||
expected: 3,
|
||||
},
|
||||
{
|
||||
string: '@€£¶‰dfg',
|
||||
expected: 14,
|
||||
},
|
||||
{
|
||||
string: '÷¶[]÷d()ß-°ú',
|
||||
expected: 18,
|
||||
},
|
||||
{
|
||||
string: 'ç€is-æ',
|
||||
expected: 10,
|
||||
},
|
||||
];
|
||||
|
||||
tests.forEach((test) =>
|
||||
getStringByteSize(test.string).should.eql(test.expected),
|
||||
);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue