Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
new hair dont care!
Browse files Browse the repository at this point in the history
  • Loading branch information
tenthirtyone committed Mar 4, 2022
1 parent e7a0b9c commit f116e2f
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 440 deletions.
6 changes: 3 additions & 3 deletions packages/db-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
"test": "jest --verbose --detectOpenHandles --forceExit --passWithNoTests"
},
"devDependencies": {
"@types/jest": "^26.0.20",
"@types/jest": "^27.4.1",
"@types/node": "12.12.21",
"@types/react": "^17.0.2",
"@types/react": "^16.8.0",
"@types/web3": "^1.0.20",
"eslint-plugin-react-hooks": "^4.3.0",
"jest": "^26.5.2",
Expand Down Expand Up @@ -72,7 +72,7 @@
"ink-syntax-highlight": "^1.0.1",
"ink-text-input": "^4.0.1",
"meow": "^9.0.0",
"react": "^17.0.1",
"react": "^16.8.0",
"source-map-support": "^0.5.19"
}
}
9 changes: 5 additions & 4 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
"@graphql-tools/schema": "^8.3.1",
"@truffle/abi-utils": "^0.2.9",
"@truffle/code-utils": "^1.2.32",
"@truffle/config": "^1.3.21",
"apollo-server": "^2.18.2",
"@truffle/config": "^1.3.20",
"abstract-leveldown": "^7.2.0",
"apollo-server": "^3.6.3",
"debug": "^4.3.1",
"fs-extra": "^9.1.0",
"graphql": "^15.3.0",
Expand All @@ -66,10 +67,10 @@
"@types/debug": "^4.1.5",
"@types/express": "^4.16.0",
"@types/graphql": "^14.5.0",
"@types/jest": "^26.0.20",
"@types/jest": "^27.4.1",
"@types/node": "12.12.21",
"@types/pluralize": "^0.0.29",
"@types/pouchdb": "^6.3.2",
"@types/pouchdb": "^6.4.0",
"@types/pouchdb-adapter-leveldb": "^6.1.3",
"@types/web3": "^1.0.20",
"change-case": "3.0.2",
Expand Down
5 changes: 2 additions & 3 deletions packages/db/src/meta/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const forAttachAndSchema = <C extends Collections>(options: {
const connect = (connectOptions?: ConnectOptions<C>): Db<C> => {
const attachOptions = {
adapter: (connectOptions || {}).adapter
}
};
const workspace = attach(attachOptions);

return {
Expand Down Expand Up @@ -68,11 +68,10 @@ export const forAttachAndSchema = <C extends Collections>(options: {
const serve = (serveOptions?: ConnectOptions<C>) => {
const attachOptions = {
adapter: (serveOptions || {}).adapter
}
};
const workspace = attach(attachOptions);

return new ApolloServer({
tracing: true,
schema,
context: { workspace }
});
Expand Down
63 changes: 36 additions & 27 deletions packages/db/src/project/test/integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { Query, Mutation } from "@truffle/db/process";

let server;
const port = 8545;

// @ts-ignore
beforeAll(async done => {
server = Ganache.server({
// note instamine must be set to eager (default) with vmErrorsOnRPCResponse enabled
Expand Down Expand Up @@ -463,24 +463,35 @@ describe("Compilation", () => {
migrationConfig.reset = true;
await Migrate.run(migrationConfig);

sourceIds = artifacts.map(artifact => ({
id: generateId("sources", {
contents: artifact["source"],
sourcePath: artifact["sourcePath"]
})
} as IdObject<"sources">));
sourceIds = artifacts.map(
artifact =>
({
id: generateId("sources", {
contents: artifact["source"],
sourcePath: artifact["sourcePath"]
})
} as IdObject<"sources">)
);

bytecodeIds = artifacts.map(artifact => ({
id: generateId(
"bytecodes", Shims.LegacyToNew.forBytecode(artifact["bytecode"])
)
} as IdObject<"bytecodes">));
bytecodeIds = artifacts.map(
artifact =>
({
id: generateId(
"bytecodes",
Shims.LegacyToNew.forBytecode(artifact["bytecode"])
)
} as IdObject<"bytecodes">)
);

callBytecodeIds = artifacts.map(artifact => ({
id: generateId(
"bytecodes", Shims.LegacyToNew.forBytecode(artifact["deployedBytecode"])
)
} as IdObject<"bytecodes">));
callBytecodeIds = artifacts.map(
artifact =>
({
id: generateId(
"bytecodes",
Shims.LegacyToNew.forBytecode(artifact["deployedBytecode"])
)
} as IdObject<"bytecodes">)
);

expectedSolcCompilationId = generateId("compilations", {
compiler: artifacts[0].compiler,
Expand Down Expand Up @@ -509,7 +520,7 @@ describe("Compilation", () => {
);
// @ts-ignore won't be undefined
let bytecodeId: string = generateId("bytecodes", shimBytecodeObject);
let callBytecodeId = generateId("bytecodes", shimCallBytecodeObject);
//let callBytecodeId = generateId("bytecodes", shimCallBytecodeObject);

// @ts-ignore won't be updefined
let contractId: string = generateId("contracts", {
Expand Down Expand Up @@ -574,7 +585,7 @@ describe("Compilation", () => {
createBytecode: {
bytecode: { id: bytecodeId },
linkValues: shimBytecodeObject.linkReferences
.filter((linkReference) => !!linkReference.name)
.filter(linkReference => !!linkReference.name)
.map(({ name }, index) => ({
// @ts-ignore name won't be null because filter
value: links[name],
Expand All @@ -587,9 +598,9 @@ describe("Compilation", () => {
}
}
});
contractInstanceIds.push({ id: contractInstanceId } as IdObject<
"contractInstances"
>);
contractInstanceIds.push({
id: contractInstanceId
} as IdObject<"contractInstances">);
contractInstances.push({
address: networksArray[networksArray.length - 1][1]["address"],
network: {
Expand Down Expand Up @@ -740,9 +751,8 @@ describe("Compilation", () => {
})
);

const solcCompilation = compilationsQuery[0].data.compilation as Resource<
"compilations"
>;
const solcCompilation = compilationsQuery[0].data
.compilation as Resource<"compilations">;

expect(solcCompilation.compiler.version).toEqual(
artifacts[0].compiler.version
Expand Down Expand Up @@ -854,7 +864,7 @@ describe("Compilation", () => {

it("loads contracts", async () => {
for (let index in artifacts) {
let expectedId = contractIds[index];
//let expectedId = contractIds[index];

let {
data: {
Expand Down Expand Up @@ -956,7 +966,6 @@ describe("Compilation", () => {
});

it("loads contract instances", async () => {

for (const contractInstanceId of contractInstanceIds) {
let {
data: {
Expand Down

0 comments on commit f116e2f

Please sign in to comment.