Upgrade Storybook

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Jamie Kyle 2023-10-11 12:06:43 -07:00 committed by GitHub
parent 8c966dfbd8
commit 502ea174ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
328 changed files with 10863 additions and 12432 deletions

View file

@ -16,7 +16,7 @@ import enMessages from '../../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
describe('SystemTrayService', function thisNeeded() {
describe('SystemTrayService', function (this: Mocha.Suite) {
// These tests take more time on CI in some cases, so we increase the timeout.
this.timeout(MINUTE);

View file

@ -83,7 +83,7 @@ describe('base_config', () => {
assert.deepEqual(_getCachedValue(), Object.create(null));
});
it('handles a file that cannot be opened, if told to', function test() {
it('handles a file that cannot be opened, if told to', function (this: Mocha.Context) {
if (process.platform === 'win32') {
this.skip();
}
@ -227,7 +227,7 @@ describe('base_config', () => {
});
describe('throwOnFilesystemErrors: true', () => {
it("doesn't update the local cache if file removal fails", async function test() {
it("doesn't update the local cache if file removal fails", async function (this: Mocha.Context) {
if (process.platform === 'win32') {
this.skip();
}
@ -252,7 +252,7 @@ describe('base_config', () => {
});
describe('throwOnFilesystemErrors: false', () => {
it('updates the local cache even if file removal fails', async function test() {
it('updates the local cache even if file removal fails', async function (this: Mocha.Context) {
if (process.platform === 'win32') {
this.skip();
}

View file

@ -15,7 +15,7 @@ import * as logger from '../../logging/log';
const gzip: (_: zlib.InputType) => Promise<Buffer> = util.promisify(zlib.gzip);
describe('upload', () => {
beforeEach(function beforeEach() {
beforeEach(function (this: Mocha.Context) {
this.sandbox = sinon.createSandbox();
this.sandbox.stub(process, 'platform').get(() => 'freebsd');
@ -35,11 +35,11 @@ describe('upload', () => {
this.fakePost.resolves({ statusCode: 204 });
});
afterEach(function afterEach() {
afterEach(function (this: Mocha.Context) {
this.sandbox.restore();
});
it('makes a request to get the S3 bucket, then uploads it there', async function test() {
it('makes a request to get the S3 bucket, then uploads it there', async function (this: Mocha.Context) {
assert.strictEqual(
await upload({ content: 'hello world', appVersion: '1.2.3', logger }),
'https://debuglogs.org/abc123.gz'
@ -75,7 +75,7 @@ describe('upload', () => {
});
});
it("rejects if we can't get a token", async function test() {
it("rejects if we can't get a token", async function (this: Mocha.Context) {
this.fakeGet.rejects(new Error('HTTP request failure'));
let err: unknown;
@ -87,7 +87,7 @@ describe('upload', () => {
assert.instanceOf(err, Error);
});
it('rejects with an invalid token body', async function test() {
it('rejects with an invalid token body', async function (this: Mocha.Context) {
const bodies = [
null,
{},
@ -114,7 +114,7 @@ describe('upload', () => {
}
});
it("rejects if the upload doesn't return a 204", async function test() {
it("rejects if the upload doesn't return a 204", async function (this: Mocha.Context) {
this.fakePost.resolves({ statusCode: 400 });
let err: unknown;

View file

@ -7,15 +7,15 @@ import * as sinon from 'sinon';
import { getUserAgent } from '../../util/getUserAgent';
describe('getUserAgent', () => {
beforeEach(function beforeEach() {
beforeEach(function (this: Mocha.Context) {
this.sandbox = sinon.createSandbox();
});
afterEach(function afterEach() {
afterEach(function (this: Mocha.Context) {
this.sandbox.restore();
});
it('returns the right User-Agent on Windows', function test() {
it('returns the right User-Agent on Windows', function (this: Mocha.Context) {
this.sandbox.stub(process, 'platform').get(() => 'win32');
assert.strictEqual(
getUserAgent('1.2.3', '10.0.22000'),
@ -23,7 +23,7 @@ describe('getUserAgent', () => {
);
});
it('returns the right User-Agent on macOS', function test() {
it('returns the right User-Agent on macOS', function (this: Mocha.Context) {
this.sandbox.stub(process, 'platform').get(() => 'darwin');
assert.strictEqual(
getUserAgent('1.2.3', '21.5.0'),
@ -31,7 +31,7 @@ describe('getUserAgent', () => {
);
});
it('returns the right User-Agent on Linux', function test() {
it('returns the right User-Agent on Linux', function (this: Mocha.Context) {
this.sandbox.stub(process, 'platform').get(() => 'linux');
assert.strictEqual(
getUserAgent('1.2.3', '20.04'),
@ -39,7 +39,7 @@ describe('getUserAgent', () => {
);
});
it('omits the platform on unsupported platforms', function test() {
it('omits the platform on unsupported platforms', function (this: Mocha.Context) {
this.sandbox.stub(process, 'platform').get(() => 'freebsd');
assert.strictEqual(getUserAgent('1.2.3', '13.1'), 'Signal-Desktop/1.2.3');
});

View file

@ -7,17 +7,16 @@ import { useFakeTimers } from 'sinon';
import { sleep } from '../../util/sleep';
describe('sleep', () => {
beforeEach(function beforeEach() {
beforeEach(function (this: Mocha.Context) {
// This isn't a hook.
// eslint-disable-next-line react-hooks/rules-of-hooks
this.clock = useFakeTimers();
});
afterEach(function afterEach() {
afterEach(function (this: Mocha.Context) {
this.clock.restore();
});
it('returns a promise that resolves after the specified number of milliseconds', async function test() {
it('returns a promise that resolves after the specified number of milliseconds', async function (this: Mocha.Context) {
let isDone = false;
void (async () => {

View file

@ -11,25 +11,25 @@ import * as Sinon from 'sinon';
import { writeWindowsZoneIdentifier } from '../../util/windowsZoneIdentifier';
describe('writeWindowsZoneIdentifier', () => {
before(function thisNeeded() {
before(function (this: Mocha.Context) {
if (process.platform !== 'win32') {
this.skip();
}
});
beforeEach(async function thisNeeded() {
beforeEach(async function (this: Mocha.Context) {
this.sandbox = Sinon.createSandbox();
this.tmpdir = await fs.promises.mkdtemp(
path.join(os.tmpdir(), 'signal-test-')
);
});
afterEach(async function thisNeeded() {
afterEach(async function (this: Mocha.Context) {
this.sandbox.restore();
await fse.remove(this.tmpdir);
});
it('writes zone transfer ID 3 (internet) to the Zone.Identifier file', async function thisNeeded() {
it('writes zone transfer ID 3 (internet) to the Zone.Identifier file', async function (this: Mocha.Context) {
const file = path.join(this.tmpdir, 'file.txt');
await fse.outputFile(file, 'hello');
@ -41,7 +41,7 @@ describe('writeWindowsZoneIdentifier', () => {
);
});
it('fails if there is an existing Zone.Identifier file', async function thisNeeded() {
it('fails if there is an existing Zone.Identifier file', async function (this: Mocha.Context) {
const file = path.join(this.tmpdir, 'file.txt');
await fse.outputFile(file, 'hello');
await fs.promises.writeFile(`${file}:Zone.Identifier`, '# already here');
@ -49,13 +49,13 @@ describe('writeWindowsZoneIdentifier', () => {
await assert.isRejected(writeWindowsZoneIdentifier(file));
});
it('fails if the original file does not exist', async function thisNeeded() {
it('fails if the original file does not exist', async function (this: Mocha.Context) {
const file = path.join(this.tmpdir, 'file-never-created.txt');
await assert.isRejected(writeWindowsZoneIdentifier(file));
});
it('fails if not on Windows', async function thisNeeded() {
it('fails if not on Windows', async function (this: Mocha.Context) {
this.sandbox.stub(process, 'platform').get(() => 'darwin');
const file = path.join(this.tmpdir, 'file.txt');