Skip to content

Commit

Permalink
fix: test case
Browse files Browse the repository at this point in the history
  • Loading branch information
csg01123119 committed Jul 24, 2023
1 parent 9b4c482 commit a00ba68
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ async function request(params) {
if (typeof timeout === 'string') {
reqParams.params.timeout = ms(timeout);
}
// console.log('ppp', reqParams.params);
result = await this.urllib.request(reqParams.url, reqParams.params);
debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers);
} catch (err) {
Expand Down
1 change: 1 addition & 0 deletions lib/rtmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ proto.putChannel = async function putChannel(id, conf, options) {
options.subres = 'live';

const params = this._objectRequestParams('PUT', id, options);
params.mime = 'xml';
params.xmlResponse = true;
params.content = jstoxml.toXML({
LiveChannelConfiguration: conf
Expand Down
15 changes: 7 additions & 8 deletions test/node/object.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (!fs.existsSync(tmpdir)) {
fs.mkdirSync(tmpdir);
}

describe.only('test/object.test.js', () => {
describe('test/object.test.js', () => {
const { prefix } = utils;
let store;
let bucket;
Expand Down Expand Up @@ -2515,9 +2515,9 @@ describe.only('test/object.test.js', () => {
});
});

describe.only('options.headerEncoding', () => {
describe('options.headerEncoding', () => {
const utf8_content = '阿达的大多';
const latin1_content = Buffer.from(utf8_content).toString('latin1');
// const latin1_content = Buffer.from(utf8_content).toString('latin1');
let name;
before(async () => {
store.options.headerEncoding = 'latin1';
Expand All @@ -2530,9 +2530,8 @@ describe.only('test/object.test.js', () => {
});
assert.equal(result.res.status, 200);
const info = await store.head(name);
console.log('info', info);
assert.equal(info.status, 200);
assert.equal(info.meta.a, latin1_content);
assert.equal(info.meta.a, utf8_content); // Urllib3 will automatically decode
});

after(() => {
Expand All @@ -2549,7 +2548,7 @@ describe.only('test/object.test.js', () => {
assert.equal(result.res.status, 200);
const info = await store.head(originname);
assert.equal(info.status, 200);
assert.equal(info.meta.a, latin1_content);
assert.equal(info.meta.a, utf8_content);
});

it('copy() should return 200 when set zh-cn meta with zh-cn object name', async () => {
Expand All @@ -2562,7 +2561,7 @@ describe.only('test/object.test.js', () => {
assert.equal(result.res.status, 200);
const info = await store.head(originname);
assert.equal(info.status, 200);
assert.equal(info.meta.a, latin1_content);
assert.equal(info.meta.a, utf8_content);
});

it('putMeta() should return 200', async () => {
Expand All @@ -2572,7 +2571,7 @@ describe.only('test/object.test.js', () => {
assert.equal(result.res.status, 200);
const info = await store.head(name);
assert.equal(info.status, 200);
assert.equal(info.meta.b, latin1_content);
assert.equal(info.meta.b, utf8_content);
});
});
});
6 changes: 3 additions & 3 deletions test/node/rtmp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,21 @@ describe('test/rtmp.test.js', () => {
createVodConf.Description = 'this is live channel 4';
const result = await store.putChannel(createVodCid, createVodConf);
assert.equal(result.res.status, 200);
const url = store.getRtmpUrl(createVodCid, {
store.getRtmpUrl(createVodCid, {
params: {
playlistName: 'vod.m3u8'
},
expires: 3600
});
console.log(url);
// console.log(url); const url =
});

after(async () => {
await store.deleteChannel(createVodCid);
});

// this case need have data in server
it.skip('should create vod playlist', async () => {
it('should create vod playlist', async () => {
const name = 'vod.m3u8';
const now = Date.now();

Expand Down

0 comments on commit a00ba68

Please sign in to comment.