Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public lualibRequire() {
// Transpile
let lua = util.transpileString(``, {dontRequireLuaLib: false, luaTarget: "JIT"});
// Assert
Expect(dedent(lua)).toBe(`require("typescript_lualib")`);
}
}
public claimIdIgnoresId(work: Work) {
// The field .id is ignored in the calculation of the id
const ignoreId = getClaimId({
...work,
id: '123'
})
Expect(ignoreId).toBe(work.id)
}
public claimIdIgnoresId(work: Work) {
// The field .id is ignored in the calculation of the id
const ignoreId = getClaimId({
...work,
id: '123',
})
Expect(ignoreId).toBe(work.id)
}
async getWorksByPublicKeyShouldReturnExpectedFields(publicKey: string, expectedClaims: ReadonlyArray) {
const response = await this.client.getWorksByPublicKey(publicKey)
Expect(response.status).toBe(200)
Expect(response.ok).toBeTruthy()
const claims: ReadonlyArray = await response.json()
for (let i = 0; i < claims.length; i++) {
Expect(claims[i].id).toBe(expectedClaims[i].id)
Expect(claims[i].publicKey).toBe(expectedClaims[i].publicKey)
Expect(claims[i].signature).toBe(expectedClaims[i].signature)
Expect(claims[i].created).toBe(expectedClaims[i].created)
}
}
public claimId(work: Work) {
const claimId = getClaimId(work)
Expect(claimId).toBe(work.id)
}
public useConfigurationModify() {
Expect(() => new ConfigurationModify(this.ssm, this.scm)).not.toThrow();
const sm = new ConfigurationModify(this.ssm, this.scm);
Expect(sm.serverSettings).toBeDefined();
Expect(sm.slashCommands).toBeDefined();
}
}
public async when_api_auth_filter_configured_then_401_unauthorized_response_contains_www_authenticate_header() {
this.app.middlewareRegistry.addAuthFilter(
new TestAuthFilter("luke", "vaderismydad")
)
let response = await this.sendRequest(
RequestBuilder.get("/test")
.build()
)
Expect(response.headers["www-authenticate"]).toBeDefined()
}
public useConfigurationModify() {
Expect(() => new ConfigurationModify(this.ssm, this.scm)).not.toThrow();
const sm = new ConfigurationModify(this.ssm, this.scm);
Expect(sm.serverSettings).toBeDefined();
Expect(sm.slashCommands).toBeDefined();
}
}
public useConfigurationExtend() {
Expect(() => new ConfigurationExtend(this.he, this.se, this.sce, this.api)).not.toThrow();
const se = new ConfigurationExtend(this.he, this.se, this.sce, this.api);
Expect(se.http).toBeDefined();
Expect(se.settings).toBeDefined();
Expect(se.slashCommands).toBeDefined();
}
}
public async mockTestController() {
Mocker.mock(TestController);
const mockResult = await TestController.list('', '');
Expect(mockResult).toBeDefined();
}